33 lines
589 B
Go
33 lines
589 B
Go
package config
|
|
|
|
import "strings"
|
|
|
|
type Config struct {
|
|
App AppConfig
|
|
}
|
|
|
|
type AppConfig struct {
|
|
Host string
|
|
HttpPort string
|
|
GrpcPort string
|
|
Domain string
|
|
Volume string
|
|
LogLevel string
|
|
}
|
|
|
|
func NewConfig() *Config {
|
|
return &Config{
|
|
App: AppConfig{
|
|
Host: getEnv("HOST", ""),
|
|
HttpPort: getEnv("HTTP_PORT", ""),
|
|
GrpcPort: getEnv("GRPC_PORT", ""),
|
|
Domain: formatDomain(getEnv("DOMAIN", "")),
|
|
Volume: getEnv("VOLUME", ""),
|
|
LogLevel: getEnv("LOG_LEVEL", ""),
|
|
},
|
|
}
|
|
}
|
|
|
|
func formatDomain(domain string) string {
|
|
return strings.TrimRight(domain, "/")
|
|
}
|