Skip to content

Commit

Permalink
Use consts for http proxy
Browse files Browse the repository at this point in the history
Signed-off-by: hmsayem <[email protected]>
  • Loading branch information
hmsayem committed Jan 1, 2024
1 parent f5312de commit d1cfb2c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions pkg/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const (
ResticRegistry = "restic"
ResticImage = "restic"
ResticTag = "0.16.0"
EnvHttpProxy = "HTTP_PROXY"
EnvHttpsProxy = "HTTPS_PROXY"
)

// Constants for debugging
Expand Down
4 changes: 2 additions & 2 deletions pkg/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ func (opt *downloadOptions) runRestoreViaDocker(destination string, args []strin
"-u", currentUser.Uid,
"-v", ScratchDir + ":" + ScratchDir,
"-v", opt.destinationDir + ":" + DestinationDir,
"--env", "HTTP_PROXY=" + os.Getenv("HTTP_PROXY"),
"--env", "HTTPS_PROXY=" + os.Getenv("HTTPS_PROXY"),
"--env", fmt.Sprintf("%s=", EnvHttpProxy) + os.Getenv(EnvHttpProxy),
"--env", fmt.Sprintf("%s=", EnvHttpsProxy) + os.Getenv(EnvHttpsProxy),
"--env-file", filepath.Join(ConfigDir, ResticEnvs),
imgRestic.ToContainerImage(),
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ func (opt *keyOptions) runCmdViaDocker(args []string) error {
"--rm",
"-u", currentUser.Uid,
"-v", ScratchDir + ":" + ScratchDir,
"--env", "HTTP_PROXY=" + os.Getenv("HTTP_PROXY"),
"--env", "HTTPS_PROXY=" + os.Getenv("HTTPS_PROXY"),
"--env", fmt.Sprintf("%s=", EnvHttpProxy) + os.Getenv(EnvHttpProxy),
"--env", fmt.Sprintf("%s=", EnvHttpsProxy) + os.Getenv(EnvHttpsProxy),
"--env-file", filepath.Join(ConfigDir, ResticEnvs),
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/unlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ func (opt *unlockOptions) runCmdViaDocker(args []string) error {
"--rm",
"-u", currentUser.Uid,
"-v", ScratchDir + ":" + ScratchDir,
"--env", "HTTP_PROXY=" + os.Getenv("HTTP_PROXY"),
"--env", "HTTPS_PROXY=" + os.Getenv("HTTPS_PROXY"),
"--env", fmt.Sprintf("%s=", EnvHttpProxy) + os.Getenv(EnvHttpProxy),
"--env", fmt.Sprintf("%s=", EnvHttpsProxy) + os.Getenv(EnvHttpsProxy),
"--env-file", filepath.Join(ConfigDir, ResticEnvs),
imgRestic.ToContainerImage(),
}
Expand Down

0 comments on commit d1cfb2c

Please sign in to comment.