Skip to content

Commit 5647f3f

Browse files
committed
Change env prefix for something for related to katafygio
While it's still time (passing config using environment variable wasn't documented yet !).
1 parent ab4a567 commit 5647f3f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ Flags:
5757
-i, --resync-interval int Resync interval in seconds (0 to disable) (default 300)
5858
```
5959

60+
## Config file and env variables
61+
62+
All settings can be passed by cli, or environment variable, or in a yaml configuration file
63+
(thanks to Viper and Cobra libs). The environment are the same as cli options, in uppercase,
64+
prefixed by "KF", and with underscore instead of dashs. ie.:
65+
66+
```
67+
export KF_GIT_URL=https://user:[email protected]/myorg/myrepos.git
68+
export KF_LOCAL_DIR=/tmp/kfdump
69+
```
70+
6071
## Build
6172

6273
Assuming you have go 1.10 and glide in the path, and GOPATH configured:

cmd/execute.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var (
4848
RootCmd = &cobra.Command{
4949
Use: appName,
5050
Short: "Backup Kubernetes cluster as yaml files",
51-
Long: "Backup Kubernetes cluster as yaml files",
51+
Long: "Backup Kubernetes cluster as yaml files in a git repository",
5252

5353
RunE: func(cmd *cobra.Command, args []string) error {
5454
conf := &config.KdnConfig{
@@ -64,7 +64,7 @@ var (
6464
}
6565
err := conf.Init(viper.GetString("api-server"), viper.GetString("kube-config"))
6666
if err != nil {
67-
return fmt.Errorf("Failed to initialize the configuration: %+v", err)
67+
return fmt.Errorf("Failed to initialize the configuration: %v", err)
6868
}
6969
run.Run(conf)
7070
return nil
@@ -150,7 +150,7 @@ func initConfig() {
150150
}
151151

152152
// allow config params through prefixed env variables
153-
viper.SetEnvPrefix("KB")
153+
viper.SetEnvPrefix("KF")
154154
replacer := strings.NewReplacer("-", "_", ".", "_DOT_")
155155
viper.SetEnvKeyReplacer(replacer)
156156
viper.AutomaticEnv()

0 commit comments

Comments
 (0)