63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package config
|
|
|
|
import (
|
|
cfg "src.dualinventive.com/go/lib/config"
|
|
mtinfo "src.dualinventive.com/go/mtinfo-go"
|
|
)
|
|
|
|
//New returns a new configuration with default values
|
|
func New() Config {
|
|
return Config{
|
|
DatabaseConfig: DatabaseConfig{
|
|
Host: "localhost",
|
|
Port: "3306",
|
|
User: "root",
|
|
Password: "admin",
|
|
Name: "mtinfo",
|
|
},
|
|
RestConfig: RestConfig{
|
|
Port: 8102,
|
|
},
|
|
GrpcConfig: GrpcConfig{
|
|
Port: "8098",
|
|
},
|
|
MtinfoClientConfig: mtinfo.Config{
|
|
Auth: mtinfo.AuthConfig{
|
|
PublicKey: "/etc/key_rsa.pub",
|
|
Grpc: mtinfo.GrpcEndpoint{
|
|
Host: "api.mtinfo.com",
|
|
Port: "3000",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
//Config reflects the configuration structure required to run this service.
|
|
type Config struct {
|
|
cfg.Config `yaml:",inline"`
|
|
DatabaseConfig DatabaseConfig `yaml:"database"`
|
|
RestConfig RestConfig `yaml:"rest"`
|
|
GrpcConfig GrpcConfig `yaml:"grpc"`
|
|
MtinfoClientConfig mtinfo.Config `yaml:"mtinfo-client"`
|
|
}
|
|
|
|
//RestConfig holds Rest server config.
|
|
type RestConfig struct {
|
|
Port int `yaml:"port"`
|
|
}
|
|
|
|
//GrpcConfig holds GRPC server config.
|
|
type GrpcConfig struct {
|
|
Port string `yaml:"port"`
|
|
}
|
|
|
|
//DatabaseConfig holds DB config.
|
|
type DatabaseConfig struct {
|
|
Host string `yaml:"host"`
|
|
Port string `yaml:"port"`
|
|
User string `yaml:"user"`
|
|
Password string `yaml:"password"`
|
|
Name string `yaml:"name"`
|
|
}
|