mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-23 21:44:41 +02:00
38 lines
548 B
Go
38 lines
548 B
Go
package config
|
|
|
|
import "time"
|
|
|
|
type Config struct {
|
|
Server ServerConfig
|
|
}
|
|
|
|
type ServerConfig struct {
|
|
Address string
|
|
Auth AuthConfig
|
|
CORS CORSConfig
|
|
}
|
|
|
|
type AuthConfig struct {
|
|
Username string
|
|
Password string
|
|
TokenSecret string
|
|
TokenExpiration time.Duration
|
|
}
|
|
|
|
type CORSConfig struct {
|
|
Enable bool `toml:"enable"`
|
|
Origin string `toml:"origin"`
|
|
}
|
|
|
|
func GetConfig() Config {
|
|
return *_cfg
|
|
}
|
|
|
|
func GetServerConfig() ServerConfig {
|
|
return _cfg.Server
|
|
}
|
|
|
|
func GetAuthConfig() AuthConfig {
|
|
return _cfg.Server.Auth
|
|
}
|