1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

turned off configfolder as flag value. Keeping just env

This commit is contained in:
postmannen 2021-08-23 11:45:31 +02:00
parent 4c895c656e
commit d897867d6a

View file

@ -179,8 +179,13 @@ func (c *Configuration) CheckFlags() error {
// Create an empty default config // Create an empty default config
var fc Configuration var fc Configuration
// Read file config. Set system default if it can't find config file. // Set default configfolder if no env was provided.
configFolder := os.Getenv("CONFIGFOLDER") configFolder := os.Getenv("CONFIGFOLDER")
if configFolder == "" {
c.ConfigFolder = "./etc/"
}
// Read file config. Set system default if it can't find config file.
fc, err := c.ReadConfigFile(configFolder) fc, err := c.ReadConfigFile(configFolder)
if err != nil { if err != nil {
log.Printf("%v\n", err) log.Printf("%v\n", err)
@ -189,7 +194,7 @@ func (c *Configuration) CheckFlags() error {
*c = fc *c = fc
flag.StringVar(&c.ConfigFolder, "configFolder", fc.ConfigFolder, "Defaults to ./usr/local/steward/etc/. *NB* This flag is not used, if your config file are located somwhere else than default set the location in an env variable named CONFIGFOLDER") //flag.StringVar(&c.ConfigFolder, "configFolder", fc.ConfigFolder, "Defaults to ./usr/local/steward/etc/. *NB* This flag is not used, if your config file are located somwhere else than default set the location in an env variable named CONFIGFOLDER")
flag.StringVar(&c.SocketFolder, "socketFolder", fc.SocketFolder, "folder who contains the socket file. Defaults to ./tmp/. If other folder is used this flag must be specified at startup.") flag.StringVar(&c.SocketFolder, "socketFolder", fc.SocketFolder, "folder who contains the socket file. Defaults to ./tmp/. If other folder is used this flag must be specified at startup.")
flag.StringVar(&c.DatabaseFolder, "databaseFolder", fc.DatabaseFolder, "folder who contains the database file. Defaults to ./var/lib/. If other folder is used this flag must be specified at startup.") flag.StringVar(&c.DatabaseFolder, "databaseFolder", fc.DatabaseFolder, "folder who contains the database file. Defaults to ./var/lib/. If other folder is used this flag must be specified at startup.")
flag.StringVar(&c.NodeName, "nodeName", fc.NodeName, "some unique string to identify this Edge unit") flag.StringVar(&c.NodeName, "nodeName", fc.NodeName, "some unique string to identify this Edge unit")