diff --git a/app/config.go b/app/config.go index 2eb4375..9ef0fe7 100644 --- a/app/config.go +++ b/app/config.go @@ -7,28 +7,37 @@ import ( "go.uber.org/zap/zapcore" ) -// Worker is a struct +// Worker describes how many service workers to launch type Worker struct { - ChannelSize int64 `mapstructure:"channel_size,omitempty"` - WorkerCount int `mapstructure:"worker_count,omitempty"` + Count int32 `mapstructure:"count,omitempty"` + Method string `mapstructure:"method,omitempty"` + Struct string `mapstructure:"struct,omitempty"` } -type metrics struct { +// CacheSize describes how to chunkify resources +type CacheSize struct { + Increment int64 +} + +// Metrics defines the if and where to collect data +type Metrics struct { Address string `mapstructure:"address,omitempty"` Enabled bool `mapstructure:"enabled,omitempty"` } -type endpoint struct { +// Endpoint describes a web URL as a service endpoint +type Endpoint struct { BasePath string `mapstructure:"base_path,omitempty"` Host string `mapstructure:"host,omitempty"` Scheme string `mapstructure:"scheme,omitempty"` } -type chunk struct { +// Chunk defines cache chunk size +type Chunk struct { size int32 `mapstructure:"size,omitempty"` } -// ServiceAccount is a struct +// ServiceAccount defines and external service type ServiceAccount struct { APIKey string `mapstructure:"api_key,omitempty"` ApplicationName string `mapstructure:"application_name,omitempty"` @@ -37,7 +46,7 @@ type ServiceAccount struct { ClientID string `mapstructure:"client_id,omitempty"` ClientSecret string `mapstructure:"client_secret,omitempty"` DSN string `mapstructure:"dsn,omitempty"` - Endpoint endpoint `mapstructure:"endpoint,omitempty"` + Endpoint Endpoint `mapstructure:"endpoint,omitempty"` Password string `mapstructure:"password,omitempty"` Production bool `mapstructure:"production,omitempty"` SecurityToken string `mapstructure:"security_token,omitempty"` @@ -48,24 +57,25 @@ type ServiceAccount struct { Vendor string `mapstructure:"vendor,omitempty"` } -type configuration struct { +// Configuration defines the config struct +type Configuration struct { AppName string `mapstructure:"app_name,omitempty"` BackendID string `mapstructure:"backend_id,omitempty"` BuildEnv string `mapstructure:"build_env,omitempty"` ClusterID string `mapstructure:"cluster_id,omitempty"` - Chunks map[string]chunk `mapstructure:"chunks,omitempty"` + Chunks map[string]Chunk `mapstructure:"chunks,omitempty"` DBMS string `mapstructure:"dbms,omitempty"` DBMSHost string `mapstructure:"dbms_host,omitempty"` DBMSName string `mapstructure:"dbms_name,omitempty"` DBMSPassword string `mapstructure:"dbms_password,omitempty"` DBMSUsername string `mapstructure:"dbms_username,omitempty"` DSN string `mapstructure:"dsn,omitempty"` - Endpoint endpoint `mapstructure:"endpoint,omitempty"` + Endpoint Endpoint `mapstructure:"endpoint,omitempty"` Environment string `mapstructure:"environment,omitempty"` GelfURI string `mapstructure:"gelf_uri,omitempty"` GitHubOrgName string `mapstructure:"git_hub_org_name,omitempty"` LogLevel int `mapstructure:"log_level,omitempty"` - Metrics metrics `mapstructure:"metrics,omitempty"` + Metrics Metrics `mapstructure:"metrics,omitempty"` KafkaServer string `mapstructure:"kafka_server,omitempty"` PDFRenderEngine string `mapstructure:"pdf_render_engine,omitempty"` RegistryPriv string `mapstructure:"registry_priv,omitempty"` diff --git a/app/root.go b/app/root.go index d6b9027..879a9ad 100644 --- a/app/root.go +++ b/app/root.go @@ -11,7 +11,7 @@ import ( ) var sugar *zap.SugaredLogger -var config = configuration{} +var config = Configuration{} var appViper = viper.New() // const dateTimeFormat = "2006-01-02T15:04:05-0800"