diff options
| author | Paul Buetow <paul@buetow.org> | 2024-09-21 14:03:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-09-21 14:03:45 +0300 |
| commit | dff4d455e07d639b82a0bed814f41d0656e9b6d0 (patch) | |
| tree | 56289a6fd80a00a9724992ab9cb8b3d7215ebedf /internal/config/client | |
| parent | 780ade3dc066afb8a43be824373414f3d316ebd6 (diff) | |
cleanup
Diffstat (limited to 'internal/config/client')
| -rw-r--r-- | internal/config/client/client.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/internal/config/client/client.go b/internal/config/client/client.go deleted file mode 100644 index f551686..0000000 --- a/internal/config/client/client.go +++ /dev/null @@ -1,41 +0,0 @@ -package client - -import ( - "fmt" - "log" - "os" - - "codeberg.org/snonux/gos/internal/config" -) - -type ClientConfig struct { - Servers []string `json:"Servers,omitempty"` - APIKey string `json:"APIKey,omitempty"` - Editor string `json:"Editor,omitempty"` - DataDir string `json:"StateDir,omitempty"` - ComposeFile string `json:"ComposeFile,omitempty"` - LogFile string `json:"LogFile,omitempty"` -} - -func New(configFile string) (ClientConfig, error) { - conf, err := config.FromFile[ClientConfig](configFile) - if err != nil { - if _, ok := err.(*os.PathError); !ok { - return conf, err - } - log.Println("Skipping config file:", err) - } - - conf.Servers = config.StrSlice("GOS_SERVERS", conf.Servers) - conf.APIKey = config.Str("GOS_API_KEY", conf.APIKey) - conf.Editor = config.Str("GOS_EDITOR", "EDITOR", conf.Editor, "vi") - - defaultDataDir := fmt.Sprintf("%s/.gos/data", os.Getenv("HOME")) - conf.DataDir = config.Str("GOS_DATA_DIR", conf.DataDir, defaultDataDir) - conf.ComposeFile = config.Str("GOS_COMPOSE_FILE", conf.ComposeFile, "compose.txt") - - defaultLogFile := fmt.Sprintf("%s/.gos/gos.log", os.Getenv("HOME")) - conf.LogFile = config.Str("GOS_LOG_FILE", conf.LogFile, defaultLogFile) - - return conf, nil -} |
