-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
63 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// configmanager.go | ||
package lib | ||
|
||
import ( | ||
"github.com/BurntSushi/toml" | ||
"log" | ||
) | ||
|
||
// utility object to manage configurable parameters | ||
|
||
type NIASConfig struct { | ||
TestYear string | ||
WebServerPort string | ||
NATSPort string | ||
ValidationRoute []string | ||
SSFRoute []string | ||
SMSRoute []string | ||
PoolSize int // number of service processors | ||
MsgTransport string | ||
TxReportInterval int // progress report after every n records | ||
UIMessageLimit int //how many messages to send to web ui | ||
TxStorageLimit int | ||
Loaded bool | ||
} | ||
|
||
var defaultConfig NIASConfig = NIASConfig{} | ||
|
||
func LoadDefaultConfig() NIASConfig { | ||
if !defaultConfig.Loaded { | ||
ncfg := NIASConfig{} | ||
if _, err := toml.DecodeFile("nias.toml", &ncfg); err != nil { | ||
log.Fatalln("Unable to read default config, aborting.", err) | ||
} | ||
defaultConfig = ncfg | ||
defaultConfig.Loaded = true | ||
} | ||
return defaultConfig | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters