Skip to content

Commit

Permalink
refactor the container config generator func
Browse files Browse the repository at this point in the history
  • Loading branch information
algo7 committed Oct 13, 2023
1 parent 21ef7f1 commit 05d72c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion container_provisioner/api/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func postProvision(c *fiber.Ctx) error {
proxyContainers := containers.AcquireProxyContainer()

// Generate the container config
scrapeConfig := containers.ContainerConfigGenerator(scrapeMode, scrapeTargetName, url, uploadIdentifier, proxyContainers.IPAddress, proxyContainers.VPNRegion)
scrapeConfig := containers.ContainerConfigGenerator(scrapeMode, scrapeTargetName, url, uploadIdentifier, proxyContainers.IPAddress, proxyContainers.VPNRegion, proxyContainers.VPNSOCKSPort)

// Create the container
containerID := containers.CreateContainer(scrapeConfig)
Expand Down
9 changes: 7 additions & 2 deletions container_provisioner/containers/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ func RemoveContainer(containerID string) {
}

// ContainerConfigGenerator generates the container config depending on the scrape target
func ContainerConfigGenerator(scrapeTarget string, scrapeTargetName string, scrapeURL string, uploadIdentifier string, proxyAddress string, proxyLocation string) *container.Config {
func ContainerConfigGenerator(
scrapeTarget string,
scrapeTargetName string,
scrapeURL string, uploadIdentifier string,
proxyAddress string, proxyLocation string, proxyPort string) *container.Config {

var scrapeContainerURL string
var targetName string

Expand All @@ -73,7 +78,7 @@ func ContainerConfigGenerator(scrapeTarget string, scrapeTargetName string, scra
}

scrapeMode := fmt.Sprintf("SCRAPE_MODE=%s", scrapeTarget)
proxySettings := fmt.Sprintf("PROXY_ADDRESS=%s", proxyAddress)
proxySettings := fmt.Sprintf("PROXY_ADDRESS=socks5://%s:%s", proxyAddress, proxyPort)

return &container.Config{
Image: containerImage,
Expand Down

0 comments on commit 05d72c5

Please sign in to comment.