Makefile, server entry point prototype, compareFiles function + other minor changes
This commit is contained in:
parent
2efb8c4130
commit
c1ccb61346
10 changed files with 139 additions and 56 deletions
|
|
@ -7,14 +7,11 @@ import (
|
|||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
|
||||
// Config will follow this model
|
||||
// server : string
|
||||
// port : int
|
||||
|
||||
|
||||
|
||||
|
||||
var config_loaded bool = false
|
||||
|
||||
// Load config file
|
||||
func LoadConfig() error {
|
||||
|
|
@ -43,6 +40,7 @@ func LoadConfig() error {
|
|||
// return err
|
||||
}
|
||||
|
||||
config_loaded = true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +55,16 @@ func LoadSyncList() error {
|
|||
}
|
||||
|
||||
// returns all config variables
|
||||
// ! WARNING: Do not use this function without executing LoadConfig prior
|
||||
func GetConfig() map[string]any {
|
||||
return viper.AllSettings()
|
||||
|
||||
if config_loaded {
|
||||
return viper.AllSettings()
|
||||
} else {
|
||||
err := LoadConfig()
|
||||
if err != nil {
|
||||
panic("GetConfig: Failed to load config file -> " + err.Error())
|
||||
}
|
||||
|
||||
return viper.AllSettings()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue