2025-01-12 10:59:36 +01:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
2025-01-12 12:09:47 +01:00
|
|
|
"git.grassecon.net/grassrootseconomics/visedriver/env"
|
2025-01-12 11:33:15 +01:00
|
|
|
viseconfig "git.grassecon.net/grassrootseconomics/visedriver/config"
|
2025-01-12 10:59:36 +01:00
|
|
|
apiconfig "git.grassecon.net/grassrootseconomics/sarafu-api/config"
|
|
|
|
)
|
|
|
|
|
2025-01-12 12:09:47 +01:00
|
|
|
func init() {
|
|
|
|
env.LoadEnvVariables()
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
defaultSSHHost string = "127.0.0.1"
|
|
|
|
defaultSSHPort uint = 7122
|
2025-01-12 16:29:12 +01:00
|
|
|
defaultHTTPHost string = "127.0.0.1"
|
|
|
|
defaultHTTPPort uint = 7123
|
2025-01-12 12:09:47 +01:00
|
|
|
)
|
|
|
|
|
2025-01-12 16:29:12 +01:00
|
|
|
|
2025-01-12 10:59:36 +01:00
|
|
|
func LoadConfig() error {
|
2025-01-12 11:33:15 +01:00
|
|
|
err := viseconfig.LoadConfig()
|
2025-01-12 10:59:36 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2025-01-12 11:33:15 +01:00
|
|
|
err = apiconfig.LoadConfig()
|
2025-01-12 10:59:36 +01:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
2025-01-12 12:09:47 +01:00
|
|
|
|
2025-01-12 13:14:25 +01:00
|
|
|
func DbConn() string {
|
|
|
|
return viseconfig.DbConn
|
|
|
|
}
|
|
|
|
|
|
|
|
func Language() string {
|
|
|
|
return viseconfig.DefaultLanguage
|
|
|
|
}
|
|
|
|
|
2025-01-12 12:09:47 +01:00
|
|
|
func Host() string {
|
2025-01-12 16:29:12 +01:00
|
|
|
return env.GetEnv("HOST", defaultHTTPHost)
|
2025-01-12 12:09:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func Port() uint {
|
2025-01-12 16:29:12 +01:00
|
|
|
return env.GetEnvUint("PORT", defaultHTTPPort)
|
2025-01-12 12:09:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func HostSSH() string {
|
|
|
|
return defaultSSHHost
|
|
|
|
}
|
|
|
|
|
|
|
|
func PortSSH() uint {
|
|
|
|
return defaultSSHPort
|
|
|
|
}
|
|
|
|
|
|
|
|
func ATEndpoint() string {
|
|
|
|
return env.GetEnv("AT_ENDPOINT", "/")
|
|
|
|
}
|