Uuuh, lots of stuff

More config, moved files, some endpoints (wip), some storage
This commit is contained in:
mStar aka a person 2024-01-19 10:21:31 +00:00
parent f3514b5a42
commit 935fc33094
18 changed files with 394 additions and 70 deletions

View file

@ -15,6 +15,7 @@ import (
"os"
"github.com/BurntSushi/toml"
"github.com/joho/godotenv"
"github.com/kelseyhightower/envconfig"
log "github.com/sirupsen/logrus"
)
@ -29,7 +30,13 @@ type CLIArguments struct {
type Config struct {
General struct {
DbPath string `envconfig:"database" toml:"database_path"`
// Path to the postgres db
DbPath string `envconfig:"DATABASE_PATH" toml:"database_path"`
// Whether the server should handle ssl itself
HandleSSL bool `envconfig:"HANDLE_SSL" toml:"handle_ssl"`
// Whether to enable the builtin frontend
EnableUI bool `envconfig:"ENABLE_UI" toml:"enable_ui"`
Domain string `envconfig:"DOMAIN" toml:"domain"`
}
}
@ -66,7 +73,7 @@ func ReadConfig(cliArgs *CLIArguments) Config {
if err != nil {
log.Fatalf("Failed to parse config file %s with error %v\n", cliArgs.ConfigFile, err)
}
godotenv.Load()
err = envconfig.Process("", &cfg)
if err != nil {
log.Fatalf("Failed to overwrite config from env. Error %v\n", err)