add user service

This commit is contained in:
kandrusyak
2023-06-23 17:24:00 +03:00
parent b3e4b8a5ab
commit eab7ec0c90
12 changed files with 114 additions and 41 deletions

41
config/config.go Normal file
View File

@@ -0,0 +1,41 @@
package config
import (
"os"
)
type MSHostsConfig struct {
UsersHost string
}
type ServerConfig struct {
Port string
JWTSecret string
}
type Config struct {
MSHosts MSHostsConfig
Server ServerConfig
}
func New() *Config {
return &Config{
MSHosts: MSHostsConfig{
UsersHost: getEnv("USERS_HOST", ""),
},
Server: ServerConfig{
Port: getEnv("PORT", ""),
JWTSecret: getEnv("JWT_SECRET", "secret"),
},
}
}
func getEnv(key string, defaultVal string) string {
if value, exists := os.LookupEnv(key); exists {
return value
}
return defaultVal
}
var Env = New()