Enhance environment variable documentation and configuration
Format / gofmt (push) Successful in 5s
CI / Build (push) Successful in 12s
CI / Go Tests (push) Successful in 22s
Release Artifacts / Validate release tag (push) Successful in 1s
Release Artifacts / Build and release executables (push) Successful in 33s
Release Artifacts / Build and release Docker image (push) Successful in 3m10s
Format / gofmt (push) Successful in 5s
CI / Build (push) Successful in 12s
CI / Go Tests (push) Successful in 22s
Release Artifacts / Validate release tag (push) Successful in 1s
Release Artifacts / Build and release executables (push) Successful in 33s
Release Artifacts / Build and release Docker image (push) Successful in 3m10s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -135,6 +135,7 @@ func TestMainProcessEnvSuccess(t *testing.T) {
|
||||
cmd.Env = append(os.Environ(),
|
||||
"GO_WANT_MAIN_HELPER=1",
|
||||
"MAIN_HELPER_MODE=env-success",
|
||||
// These are from the canonical envSuffixes list (internal/config/config.go)
|
||||
"SCRATCHBOX_SERVER_LISTEN_ADDR=127.0.0.1:0",
|
||||
"SCRATCHBOX_STORAGE_DATA_DIR="+filepath.Join(tmp, "data"),
|
||||
"SCRATCHBOX_SECURITY_ALLOWED_IPS=",
|
||||
|
||||
@@ -34,7 +34,7 @@ func newServerCmd() *cobra.Command {
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringVarP(&configPath, "config", "c", "", "path to config file")
|
||||
cmd.Flags().BoolVar(&useEnv, "env", false, "load config from SCRATCHBOX_* environment variables")
|
||||
cmd.Flags().BoolVar(&useEnv, "env", false, "load config from SCRATCHBOX_* environment variables (see envSuffixes in internal/config/config.go)")
|
||||
cmd.MarkFlagsMutuallyExclusive("config", "env")
|
||||
return cmd
|
||||
}
|
||||
@@ -134,6 +134,8 @@ func run(configPath string, useEnv bool) error {
|
||||
}
|
||||
|
||||
func printEnvStartup() int {
|
||||
// All SCRATCHBOX_* variables are defined by envSuffixes (single source of truth)
|
||||
// in internal/config/config.go. See the comment there for update rules.
|
||||
entries := make([]string, 0)
|
||||
for _, item := range os.Environ() {
|
||||
if strings.HasPrefix(item, "SCRATCHBOX_") {
|
||||
|
||||
Reference in New Issue
Block a user