63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/joho/godotenv"
|
|
)
|
|
|
|
var Cfg Config
|
|
|
|
type Config struct {
|
|
Debug bool
|
|
ColorizedOutput bool
|
|
Host string
|
|
Port string
|
|
FolderPaths FolderPaths
|
|
MariaDB MariaDB
|
|
LogLanguageGroupTasks string
|
|
LogLanguageSystem string
|
|
}
|
|
|
|
type FolderPaths struct {
|
|
GroupTasksGroups string
|
|
GroupTasksRunningTasks string
|
|
LogsGroupTasks string
|
|
LogsSystem string
|
|
PublicStatic string
|
|
}
|
|
|
|
type MariaDB struct {
|
|
Hostname string
|
|
Port string
|
|
Username string
|
|
Password string
|
|
DatabaseName string
|
|
}
|
|
|
|
func LoadConfig() {
|
|
godotenv.Load(".env")
|
|
|
|
Cfg = Config{
|
|
Debug: os.Getenv("DEBUG") == "true",
|
|
ColorizedOutput: os.Getenv("COLORIZED_OUTPUT") == "true",
|
|
Host: os.Getenv("HOST"),
|
|
Port: os.Getenv("PORT"),
|
|
FolderPaths: FolderPaths{
|
|
GroupTasksGroups: os.Getenv("FOLDER_GROUPTASKS_GROUPS"),
|
|
GroupTasksRunningTasks: os.Getenv("FOLDER_GROUPTASKS_RUNNINGTASKS"),
|
|
LogsGroupTasks: os.Getenv("FOLDER_LOGS_GROUPTASKS"),
|
|
LogsSystem: os.Getenv("FOLDER_LOGS_SYSTEM"),
|
|
PublicStatic: os.Getenv("FOLDER_PUBLIC_STATIC"),
|
|
},
|
|
LogLanguageGroupTasks: os.Getenv("LOG_LANGUAGE_GROUPTASKS"),
|
|
LogLanguageSystem: os.Getenv("LOG_LANGUAGE_SYSTEM"),
|
|
MariaDB: MariaDB{
|
|
Hostname: os.Getenv("MARIADB_HOSTNAME"),
|
|
Port: os.Getenv("MARIADB_PORT"),
|
|
Username: os.Getenv("MARIADB_USERNAME"),
|
|
Password: os.Getenv("MARIADB_PASSWORD"),
|
|
DatabaseName: os.Getenv("MARIADB_DATABASE_NAME")},
|
|
}
|
|
}
|