config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetC4GHKey

func GetC4GHKey() (*[32]byte, error)

GetC4GHKey reads and decrypts and returns the c4gh key

Types

type AppConfig

type AppConfig struct {
	// Hostname for this web app
	// Optional. Default value localhost
	Host string

	// Port number for this web app
	// Optional. Default value 8080
	Port int

	// Logging level
	// Optional. Default value debug
	// Possible values error, fatal, info, panic, warn, trace, debug
	LogLevel string

	// TLS server certificate for HTTPS
	// Optional. Defaults to empty
	TLSCert string

	// TLS server certificate key for HTTPS
	// Optional. Defaults to empty
	TLSKey string

	// Stores the Crypt4GH private key if the two configs above are set
	// Unconfigurable. Depends on Crypt4GHKeyFile and Crypt4GHPassFile
	Crypt4GHKey *[32]byte

	// Path to POSIX Archive, prepended to database file name
	// Optional.
	ArchivePath string
}

type ConfigMap

type ConfigMap struct {
	App     AppConfig
	Session SessionConfig
	DB      DatabaseConfig
	OIDC    OIDCConfig
}

ConfigMap stores all different configs

var Config ConfigMap

Config is a global configuration value store

func NewConfig

func NewConfig() (*ConfigMap, error)

NewConfig populates ConfigMap with data

type DatabaseConfig

type DatabaseConfig struct {
	// Database hostname
	// Optional. Default value localhost
	Host string

	// Database port number
	// Optional. Default value 5432
	Port int

	// Database username
	// Optional. Default value lega_out
	User string

	// Database password for username
	// Optional. Default value lega_out
	Password string

	// Database name
	// Optional. Default value lega
	Database string

	// TLS CA cert for database connection
	// Optional.
	CACert string

	// CA cert for database connection
	// Optional.
	SslMode string

	// TLS Certificate for database connection
	// Optional.
	ClientCert string

	// TLS Key for database connection
	// Optional.
	ClientKey string
}

type OIDCConfig

type OIDCConfig struct {
	// OIDC OP configuration URL /.well-known/openid-configuration
	// Mandatory.
	ConfigurationURL string
}

type SessionConfig added in v1.1.0

type SessionConfig struct {
	// Session key expiration time in seconds.
	// Optional. Default value -1
	// Negative values disable the session and requires visa auth to be done on every request.
	// Positive values indicate amount of seconds the session stays active, e.g. 3600 for one hour.
	Expiration time.Duration

	// Cookie domain, this should be the hostname of the server.
	// Optional. Default value empty.
	Domain string

	// Cookie secure value. If true, cookie can only travel in HTTPS.
	// Optional. Default value true
	Secure bool

	// Cookie HTTPOnly value. If true, cookie can't be read by JavaScript.
	// Optional. Default value true
	HTTPOnly bool
}

Jump to

Keyboard shortcuts

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