package config import ( cfg "src.dualinventive.com/go/lib/config" ) //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", }, RedisConfig: RedisConfig{ Host: "localhost", Port: "6739", Password: "", Database: 0, }, RestConfig: RestConfig{ Port: 8102, }, GrpcConfig: GrpcConfig{ Port: "8098", }, TemplateConfig: TemplateConfig{ TemplateFilePath: "/etc/email.tmp", }, EmailConfig: EmailConfig{ Host: "localhost", Port: "465", Username: "", Password: "", SenderAddr: "user@localhost.com", }, JWTConfig: JWTConfig{ PrivateKey: "", PublicKey: "", }, } } //Config reflects the configuration structure required to run this service. type Config struct { cfg.Config `yaml:",inline"` DatabaseConfig DatabaseConfig `yaml:"database"` RedisConfig RedisConfig `yaml:"redis"` RestConfig RestConfig `yaml:"rest"` GrpcConfig GrpcConfig `yaml:"grpc"` TemplateConfig TemplateConfig `yaml:"template"` EmailConfig EmailConfig `yaml:"smtp"` JWTConfig JWTConfig `yaml:"jwt"` } //JWTConfig contains token generation settings. type JWTConfig struct { PrivateKey string `yaml:"private_key"` PublicKey string `yaml:"public_key"` } //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"` } //RedisConfig contains connection configuration for a redis token repository. type RedisConfig struct { Host string `yaml:"host"` Port string `yaml:"port"` Password string `yaml:"password"` Database int `yaml:"database"` } //EmailConfig contains smtp connection configuration data. type EmailConfig struct { Host string `yaml:"host"` Port string `yaml:"port"` Username string `yaml:"username"` Password string `yaml:"pass"` SenderAddr string `yaml:"sender"` } //TemplateConfig contains configuration data about where template files are to be found. type TemplateConfig struct { TemplateFilePath string `yaml:"file-path"` }