mirror of
https://github.com/restic/restic.git
synced 2025-08-26 09:28:01 +00:00
backend: Move environment based configuration into backend
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package gs
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@@ -56,3 +57,12 @@ func ParseConfig(s string) (interface{}, error) {
|
||||
cfg.Prefix = prefix
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// ApplyEnvironment saves values from the environment to the config.
|
||||
func ApplyEnvironment(cfgRaw interface{}) error {
|
||||
cfg := cfgRaw.(*Config)
|
||||
if cfg.ProjectID == "" {
|
||||
cfg.ProjectID = os.Getenv("GOOGLE_PROJECT_ID")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user