mirror of
https://github.com/postmannen/ctrl.git
synced 2024-12-14 12:37:31 +00:00
fixed an error creating default config file
This commit is contained in:
parent
18272d73ab
commit
2e06a0c3f4
2 changed files with 15 additions and 10 deletions
12
README.md
12
README.md
|
@ -217,13 +217,15 @@ clone the repository, then cd `./steward/cmd` and do `go build -o steward`, and
|
|||
|
||||
### Options for running
|
||||
|
||||
The location of the config file are given via an env variable at startup (default "./etc/).
|
||||
|
||||
`env CONFIG_FOLDER </myconfig/folder/here>`
|
||||
|
||||
```text
|
||||
-brokerAddress string
|
||||
the address of the message broker (default "127.0.0.1:4222")
|
||||
-centralNodeName string
|
||||
The name of the central node to receive messages published by this node (default "central")
|
||||
-configFolder string
|
||||
folder who contains the config file. Defaults to ./etc/. If other folder is used this flag must be specified at startup. (default "./etc")
|
||||
-defaultMessageRetries int
|
||||
default amount of retries that will be done before a message is thrown away, and out of the system (default 3)
|
||||
-defaultMessageTimeout int
|
||||
|
@ -340,11 +342,11 @@ More example configurations for the nats-server are located in the `doc` folder
|
|||
|
||||
#### Steward
|
||||
|
||||
To set the location of the config folder other than default, you should use the ENV variable `CONFIGFOLDER`.
|
||||
To set the location of the config folder other than default, you should use the ENV variable `CONFIG_FOLDER`.
|
||||
|
||||
`env CONFIGFOLDER=./etc/ ./steward --node="central"`
|
||||
`env CONFIG_FOLDER=./etc/ ./steward --node="central"`
|
||||
|
||||
Using default configfolder location on some central server which will act as your command and control server.
|
||||
Using default config folder location on some central server which will act as your command and control server.
|
||||
|
||||
`./steward --node="central"`
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ func NewConfiguration() *Configuration {
|
|||
// Default configuration
|
||||
func newConfigurationDefaults() Configuration {
|
||||
c := Configuration{
|
||||
ConfigFolder: "/usr/local/steward/etc/",
|
||||
ConfigFolder: "./etc/",
|
||||
SocketFolder: "./tmp",
|
||||
TCPListener: "",
|
||||
DatabaseFolder: "./var/lib",
|
||||
|
@ -184,10 +184,7 @@ func (c *Configuration) CheckFlags() error {
|
|||
var fc Configuration
|
||||
|
||||
// Set default configfolder if no env was provided.
|
||||
configFolder := os.Getenv("CONFIGFOLDER")
|
||||
if configFolder == "" {
|
||||
c.ConfigFolder = "./etc/"
|
||||
}
|
||||
configFolder := os.Getenv("CONFIG_FOLDER")
|
||||
|
||||
// Read file config. Set system default if it can't find config file.
|
||||
fc, err := c.ReadConfigFile(configFolder)
|
||||
|
@ -196,6 +193,12 @@ func (c *Configuration) CheckFlags() error {
|
|||
fc = newConfigurationDefaults()
|
||||
}
|
||||
|
||||
if configFolder == "" {
|
||||
fc.ConfigFolder = "./etc/"
|
||||
} else {
|
||||
fc.ConfigFolder = configFolder
|
||||
}
|
||||
|
||||
*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")
|
||||
|
|
Loading…
Reference in a new issue