Initial Commit

This commit is contained in:
2023-09-18 19:57:18 -04:00
commit 1a1fb31a3c
52 changed files with 6882 additions and 0 deletions

34
config/config.go Normal file
View File

@@ -0,0 +1,34 @@
package config
import (
"os"
)
type Config struct {
DBType string
DBName string
DBPassword string
ConfigPath string
DataPath string
ListenPort string
Version string
}
func Load() *Config {
return &Config{
DBType: getEnv("DATABASE_TYPE", "SQLite"),
DBName: getEnv("DATABASE_NAME", "bbank"),
DBPassword: getEnv("DATABASE_PASSWORD", ""),
ConfigPath: getEnv("CONFIG_PATH", "/config"),
DataPath: getEnv("DATA_PATH", "/data"),
ListenPort: getEnv("LISTEN_PORT", "8585"),
Version: "0.0.1",
}
}
func getEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}