Commit 9495ed51 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Add all json tags to config

parent b7e52630
......@@ -54,7 +54,7 @@ type (
// Services maps an (arbitrary) service identifier to service structs
// the service identifiers are referenced in GroupToServiceIDs and EntitlementToServiceIDs
Services map[ServiceID]Service
Services map[ServiceID]Service `json:"services"`
// GroupToServiceIDs determines which services are provided for users of the
// group
......@@ -69,25 +69,25 @@ type (
EntitlementToServiceIDs map[string][]ServiceID `json:"entitlement_to_service_ids"`
// FetchIntervalString gets parsed by time.ParseDuration
FetchIntervalString string `json:"fetch_interval"`
FetchIntervalString string `json:"fetch_interval,omitempty"`
// ReconnectTimeout gets parsed by time.ParseDuration
ReconnectTimeoutString string `json:"reconnect_timeout"`
ReconnectTimeoutString string `json:"reconnect_timeout,omitempty"`
// Debug flags control the log levels of the client.
Debug DebugConfig `json:"debug,omitempty"`
// After the duration of FetchInterval the client will fetch updates using the REST
// interface.
FetchInterval time.Duration
FetchInterval time.Duration `json:"-"`
// We reconnect to RabbitMQ after ReconnectTimeout.
ReconnectTimeout time.Duration
ReconnectTimeout time.Duration `json:"-"`
RabbitMQConfig RabbitMQConfig
RabbitMQConfig RabbitMQConfig `json:"-"`
// The Site is the name of the site of this client. It is fetched from the backend.
Site string
// Debug flags control the log levels of the client.
Debug DebugConfig `json:"debug"`
Site string `json:"-"`
// strippedConfig is sent to the backend on startup
......@@ -263,6 +263,9 @@ func (conf *Config) validateConfig() (err error) {
// ReadConfig reads a config file and validates it
func ReadConfig(configFile string) (conf *Config, err error) {
if configFile == "" {
return nil, fmt.Errorf("Please provide the --config flag. See --help")
log.Printf("[Conf] Reading config file %s", configFile)
configBytes, err := ioutil.ReadFile(configFile)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment