config

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 10 Imported by: 1

README

Configuration module

The configuration module contains configurations for all CHESS services.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Info

func Info() string

func Init

func Init()

Types

type Authz

type Authz struct {
	WebServer  `mapstructure:"WebServer"`
	Encryption `mapstructure:"Encryption"`

	TestMode     bool   `mapstructure:TestMode` // test mode
	DBUri        string `mapstructure:"DBUri"`  // database URI
	ClientID     string `mapstructure:"ClientId"`
	ClientSecret string `mapstructure:"ClientSecret"`
	Domain       string `mapstructure:"Domain"`
	TokenExpires int64  `mapstructure:TokenExpires` // expiration of token
}

Authz represents authz service configuration

type CHESSMetaData

type CHESSMetaData struct {
	WebServer           `mapstructure:"WebServer"`
	MongoDB             `mapstructure:"MongoDB"`
	TestMode            bool                `mapstructure:TestMode`      // test mode
	SchemaFiles         []string            `json:"SchemaFiles"`         // schema files
	SchemaRenewInterval int                 `json:"SchemaRenewInterval"` // schema renew interval
	SchemaSections      []string            `json:"SchemaSections"`      // logical schema section list
	WebSectionKeys      map[string][]string `json:"WebSectionKeys"`      // section order dict
}

CHESSMetaData represents CHESS MetaData configuration

type DataBookkeeping

type DataBookkeeping struct {
	WebServer `mapstructure:"WebServer"`

	DBFile             string `mapstructure:"DBFile"`             // dbs db file with secrets
	MaxDBConnections   int    `mapstructure:"MaxDbConnections"`   // maximum number of DB connections
	MaxIdleConnections int    `mapstructure:"MaxIdleConnections"` // maximum number of idle connections
}

DataBookkeeping represents data-bookkeeping service configuration

type DataManagement

type DataManagement struct {
	WebServer `mapstructure:"WebServer"`
}

DataManagement represents data-management service configuration

type Discovery

type Discovery struct {
	WebServer  `mapstructure:"WebServer"`
	MongoDB    `mapstructure:"MongoDB"`
	Encryption `mapstructure:"Encryption"`
}

Discovery represents discovery service configuration

type Encryption

type Encryption struct {
	Secret string `mapstructure:"Secret"`
	Cipher string `mapstructure:"Cipher"`
}

Encryption represents encryption configuration parameters

type Frontend

type Frontend struct {
	WebServer `mapstructure:"WebServer"`

	// OAuth parts
	OAuth []OAuthRecord `mapstructure:"OAuth"` // oauth configurations

	// captcha parts
	CaptchaSecretKey string `mapstructure:"CaptchaSecretKey"` // re-captcha secret key
	CaptchaPublicKey string `mapstructure:"CaptchaPublicKey"` // re-captcha public key
	CaptchaVerifyUrl string `mapstructure:"CaptchaVerifyUrl"` // re-captcha verify url

	// cookies parts
	UserCookieExpires int64 `mapstructure:"UserCookieExpires"` // expiration of user cookie

	// other options
	TestMode bool `mapstructure:TestMode` // test mode
}

Frontend stores frontend configuration parameters

type GinOptions

type GinOptions struct {
	DisableConsoleColor bool   `mapstructure:"DisableConsoleColor"` // gin console color mode
	Production          bool   `mapstructure:"Production"`          // production mode
	Mode                string `mapstructure:"Mode"`                // gin mode: test, debug, release
}

GinOptions controls go-gin specific options

type Kerberos

type Kerberos struct {
	Krb5Conf string `mapstructure:Krb5Conf`
	Keytab   string `mapstructure:Keytab`
	Realm    string `mapstructure:Realm`
}

Kerberos defines kerberos optinos

type MetaData

type MetaData struct {
	WebServer `mapstructure:"WebServer"`
	MongoDB   `mapstructure:"MongoDB"`
}

MetaData represents metadata service configuration

type MongoDB

type MongoDB struct {
	DBName string `mapstructure:"DBName"` // database name
	DBColl string `mapstructure:"DBColl"` // database collection
	DBUri  string `mapstructure:"DBUri"`  // database URI
}

MongoDB represents MongoDB parameters

type OAuthRecord

type OAuthRecord struct {
	Provider     string `mapstructure:"Provider"`     // name of the provider
	ClientID     string `mapstructure:"ClientId"`     // client id
	ClientSecret string `mapstructure:"ClientSecret"` // client secret
}

OAuthRecord defines OAuth provider's credentials

type OreCastMetaData

type OreCastMetaData struct {
	WebServer `mapstructure:"WebServer"`
	MongoDB   `mapstructure:"MongoDB"`
}

OreCastMetaData represents OreCast MetaData configuration

type Services

type Services struct {
	FrontendURL        string `mapstructure:"FrontendUrl"`
	DiscoveryURL       string `mapstructure:"DiscoveryUrl"`
	MetaDataURL        string `mapstructure:"MetaDataUrl"`
	DataManagementURL  string `mapstructure:"DataManagementUrl"`
	DataBookkeepingURL string `mapstructure:"DataBookkeepingUrl"`
	AuthzURL           string `mapstructure:"AuthzUrl"`
}

Services represents services structure

type SrvConfig

type SrvConfig struct {
	Frontend        `mapstructure:"Frontend"`
	Discovery       `mapstructure:"Discovery"`
	MetaData        `mapstructure:"MetaData"`
	DataManagement  `mapstructure:"DataManagement"`
	DataBookkeeping `mapstructure:"DataBookkeeping"`
	Authz           `mapstructure:"Authz"`
	Kerberos        `mapstructure:"Kerberos"`
	Services        `mapstructure:"Services"`
	Encryption      `mapstructure:"Encryption"`
	CHESSMetaData   `mapstructure:"CHESSMetaData"`
	OreCastMetaData `mapstructure:"OreCastMetaData"`
}

SrvConfig represents configuration structure

var Config *SrvConfig

Config represnets configuration instance

func ParseConfig

func ParseConfig(cfile string) (SrvConfig, error)

type WebServer

type WebServer struct {
	// git server options
	GinOptions `mapstructure:"GinOptions"`

	// basic options
	Port        int    `mapstructure:"Port"`        // server port number
	Verbose     int    `mapstructure:"Verbose"`     // verbose output
	Base        string `mapstructure:"Base"`        // base URL
	StaticDir   string `mapstructure:"StaticDir"`   // speficy static dir location
	LogFile     string `mapstructure:"LogFile"`     // server log file
	LogLongFile bool   `mapstructure:"LogLongFile"` // server log structure

	// middleware server parts
	LimiterPeriod string `mapstructure:"Rate"` // limiter rate value

	// proxy parts
	XForwardedHost      string `mapstructure:"X-Forwarded-Host"`       // X-Forwarded-Host field of HTTP request
	XContentTypeOptions string `mapstructure:"X-Content-Type-Options"` // X-Content-Type-Options option

	// TLS server parts
	RootCAs     string   `mapstructure:"RootCAs"`     // server Root CAs path
	ServerCrt   string   `mapstructure:"ServerCert"`  // server certificate
	ServerKey   string   `mapstructure:"ServerKey"`   // server certificate
	DomainNames []string `mapstructure:"DomainNames"` // LetsEncrypt domain names
}

WebServer represents common web server configuration

func (*WebServer) String added in v0.0.2

func (w *WebServer) String() string

String provides string representation of WebServer structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL