You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dashboard/config/config.go

54 lines
761 B
Go

package config
import "time"
const (
EnvDev = "dev"
EnvProd = "prod"
)
type Config struct {
Server ServerConfig
}
type ServerConfig struct {
Env string
Address string
Auth AuthConfig
CORS CORSConfig
Swagger SwaggerConfig
}
type AuthConfig struct {
Username string
Password string
TokenSecret string
TokenExpiration time.Duration
}
type CORSConfig struct {
Enable bool `toml:"enable"`
Origin string `toml:"origin"`
}
type SwaggerConfig struct {
Host string
Base string
}
func GetConfig() Config {
return *_cfg
}
func GetServerConfig() ServerConfig {
return _cfg.Server
}
func GetAuthConfig() AuthConfig {
return _cfg.Server.Auth
}
func GetSwaggerConfig() SwaggerConfig {
return _cfg.Server.Swagger
}