@@ -63,13 +63,13 @@ func (rc *ResolvedConfig) HasFlag(name string) bool {
return false
}
-// commandSuffix is the suffix keld recognises in .environ keys to indicate
+// CommandSuffix is the suffix keld recognises in .environ keys to indicate
// that the value is a shell command whose stdout should be captured and
// used as the actual variable value (with the suffix stripped).
//
// For example, RESTIC_REPOSITORY_COMMAND = "op read ..." resolves to
// RESTIC_REPOSITORY at execution time.
-const commandSuffix = "_COMMAND"
+const CommandSuffix = "_COMMAND"
// HasEnvSource reports whether the given environment variable will have
// a value when the restic process runs. It checks three sources in
@@ -87,7 +87,7 @@ func (rc *ResolvedConfig) HasEnvSource(key string) bool {
if _, ok := rc.Environ[key]; ok {
return true
}
- if _, ok := rc.Environ[key+commandSuffix]; ok {
+ if _, ok := rc.Environ[key+CommandSuffix]; ok {
return true
}
}
@@ -12,10 +12,7 @@ import (
"git.secluded.site/keld/internal/config"
)
-// commandSuffix is the suffix keld recognises in .environ keys to indicate-// that the value is a shell command whose stdout should be captured and used-// as the actual environment variable value (with the suffix stripped).-const commandSuffix = "_COMMAND"
+
// resticNativeCommands lists .environ keys that restic handles natively.
// Keld passes these through as-is rather than executing them.
@@ -122,14 +119,14 @@ func buildArgv(exe string, cfg *config.ResolvedConfig) []string {
// and FOO_COMMAND is removed from the map.
func resolveEnvironCommands(environ map[string]string) error {
for key, cmd := range environ {
- if !strings.HasSuffix(key, commandSuffix) {
+ if !strings.HasSuffix(key, config.CommandSuffix) {
continue
}
if resticNativeCommands[key] {
continue
}
- baseKey := strings.TrimSuffix(key, commandSuffix)
+ baseKey := strings.TrimSuffix(key, config.CommandSuffix)
if baseKey == "" {
continue
}