35 lines
548 B
Go
35 lines
548 B
Go
package config
|
|
|
|
import "os"
|
|
|
|
type (
|
|
DBCfg struct {
|
|
DatabaseURL string
|
|
}
|
|
|
|
ServerCfg struct {
|
|
SessionKey string
|
|
Env string
|
|
CertFile string
|
|
CertKeyFile string
|
|
}
|
|
|
|
Config struct {
|
|
DB DBCfg
|
|
Server ServerCfg
|
|
}
|
|
)
|
|
|
|
func New() *Config {
|
|
return &Config{
|
|
DB: DBCfg{
|
|
DatabaseURL: os.Getenv("DATABASE_URL"),
|
|
},
|
|
Server: ServerCfg{
|
|
SessionKey: os.Getenv("SESSION_KEY"),
|
|
Env: os.Getenv("ENV"),
|
|
CertFile: os.Getenv("CERT_FILE"),
|
|
CertKeyFile: os.Getenv("CERT_KEY_FILE"),
|
|
},
|
|
}
|
|
}
|