diff options
| author | Jeff Carr <[email protected]> | 2025-10-15 12:20:03 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-15 12:20:03 -0500 |
| commit | fab3ce3d8b31ca17a392c34e5fee591ce5ad443f (patch) | |
| tree | 5aa5f6f7f15e3cdd2a3aa273d6858ef7aac8ffe6 /flags.go | |
| parent | e53c5bb205827022eca057327869ff7beb2dd27c (diff) | |
move in a common place. mutex lock access (seems to work)v0.0.26
Diffstat (limited to 'flags.go')
| -rw-r--r-- | flags.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/flags.go b/flags.go deleted file mode 100644 index 24a3fce..0000000 --- a/flags.go +++ /dev/null @@ -1,55 +0,0 @@ -package config - -// returns true if config is working okay -func InitValid() bool { - if configPB == nil { - // todo: try to re-init it here - return false - } - return true -} - -func Get(flag string) string { - if configPB == nil { - return "" - } - found := configPB.FindByKey(flag) - if found == nil { - return "" - } - return found.Value -} - -func GetPanic(flag string) string { - if configPB == nil { - configPanic(flag) - } - found := configPB.FindByKey(flag) - if found == nil { - configPanic(flag) - } - return found.Value -} - -func configPanic(varname string) { - if configPB == nil { - panic("config file is nil") - } - panic("config name '" + varname + "' not found") -} - -func Set(key string, newValue string) error { - if configPB == nil { - return NotInitialized - } - found := configPB.FindByKey(key) - if found != nil { - found.Value = newValue - } - - newvar := new(Config) - newvar.Key = key - newvar.Value = newValue - configPB.Append(newvar) - return nil -} |
