github.com/cs3org/reva/v2@v2.27.7/pkg/mentix/config/config.go (about)

     1  // Copyright 2018-2021 CERN
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  // In applying this license, CERN does not waive the privileges and immunities
    16  // granted to it by virtue of its status as an Intergovernmental Organization
    17  // or submit itself to any jurisdiction.
    18  
    19  package config
    20  
    21  // Configuration holds the general Mentix configuration.
    22  type Configuration struct {
    23  	Prefix string `mapstructure:"prefix"`
    24  
    25  	Connectors struct {
    26  		GOCDB struct {
    27  			Address string `mapstructure:"address"`
    28  			Scope   string `mapstructure:"scope"`
    29  			APIKey  string `mapstructure:"apikey"`
    30  		} `mapstructure:"gocdb"`
    31  	} `mapstructure:"connectors"`
    32  
    33  	UpdateInterval string `mapstructure:"update_interval"`
    34  
    35  	Services struct {
    36  		CriticalTypes []string `mapstructure:"critical_types"`
    37  	} `mapstructure:"services"`
    38  
    39  	Exporters struct {
    40  		WebAPI struct {
    41  			Endpoint          string   `mapstructure:"endpoint"`
    42  			EnabledConnectors []string `mapstructure:"enabled_connectors"`
    43  			IsProtected       bool     `mapstructure:"is_protected"`
    44  		} `mapstructure:"webapi"`
    45  
    46  		CS3API struct {
    47  			Endpoint             string   `mapstructure:"endpoint"`
    48  			EnabledConnectors    []string `mapstructure:"enabled_connectors"`
    49  			IsProtected          bool     `mapstructure:"is_protected"`
    50  			ElevatedServiceTypes []string `mapstructure:"elevated_service_types"`
    51  		} `mapstructure:"cs3api"`
    52  
    53  		SiteLocations struct {
    54  			Endpoint          string   `mapstructure:"endpoint"`
    55  			EnabledConnectors []string `mapstructure:"enabled_connectors"`
    56  			IsProtected       bool     `mapstructure:"is_protected"`
    57  		} `mapstructure:"siteloc"`
    58  
    59  		PrometheusSD struct {
    60  			OutputPath        string   `mapstructure:"output_path"`
    61  			EnabledConnectors []string `mapstructure:"enabled_connectors"`
    62  		} `mapstructure:"promsd"`
    63  
    64  		Metrics struct {
    65  			EnabledConnectors []string `mapstructure:"enabled_connectors"`
    66  		} `mapstructure:"metrics"`
    67  	} `mapstructure:"exporters"`
    68  
    69  	AccountsService struct {
    70  		URL      string `mapstructure:"url"`
    71  		User     string `mapstructure:"user"`
    72  		Password string `mapstructure:"password"`
    73  	} `mapstructure:"accounts"`
    74  
    75  	// Internal settings
    76  	EnabledConnectors []string `mapstructure:"-"`
    77  	EnabledImporters  []string `mapstructure:"-"`
    78  	EnabledExporters  []string `mapstructure:"-"`
    79  }
    80  
    81  // Init sets sane defaults.
    82  func (c *Configuration) Init() {
    83  	if c.Prefix == "" {
    84  		c.Prefix = "mentix"
    85  	}
    86  	// TODO(daniel): add default that works out of the box
    87  }