config

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Copyright 2023 WeFuzz Research and Development B.V.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2023 WeFuzz Research and Development B.V.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2023 WeFuzz Research and Development B.V.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const Version = 1

Current Config Version

Variables

This section is empty.

Functions

This section is empty.

Types

type CMConfig

type CMConfig struct {
	// The version of the configuration file.
	Version      int          `yaml:"version"`
	ServerConfig ServerConfig `yaml:"server"`

	PrivateKey ed25519.PrivateKey
	PublicKey  ed25519.PublicKey
}

Chronometry config

func LoadConfig

func LoadConfig(configPath string) (*CMConfig, error)

type ConfigErrors

type ConfigErrors []string

ConfigErrors stores problems encountered when parsing a config file. It implements the error interface.

func (*ConfigErrors) Add

func (errs *ConfigErrors) Add(str string)

Add appends an error to the list of errors in this configErrors. It is a wrapper to the builtin append and hides pointers from the client code. This method is safe to use with an uninitialized configErrors because if it is nil, it will be properly allocated.

func (ConfigErrors) Error

func (errs ConfigErrors) Error() string

Error returns a string detailing how many errors were contained within a configErrors type.

type DatabaseOptions

type DatabaseOptions struct {
	// The username for postgres server
	Username string `yaml: "username"`
	Password string `yaml: "password"`

	DBName string `yaml:"dbname"`

	// Postgres server host
	Server string `yaml:"server"`
	// Postgress server port
	Port string `yaml:"port"`
	//ssl mode
	SSLmode string `yaml:"sslmode"`

	//timezone
	TimeZone string `yaml:"timezone"`

	// Maximum open connections to the DB (0 = use default, negative means unlimited)
	MaxOpenConnections int `yaml:"max_open_conns"`

	// Maximum idle connections to the DB (0 = use default, negative means unlimited)
	MaxIdleConnections int `yaml:"max_idle_conns"`

	// maximum amount of time (in seconds) a connection may be reused (<= 0 means unlimited)
	ConnMaxLifetimeSeconds int `yaml:"conn_max_lifetime"`
}

Postgres Config

type LoggerOpts

type LoggerOpts struct {
	LogLevel      string `yaml:"log_level"`
	AccessLogFile string `yaml:"access_log"`
	ErrorLogFile  string `yaml:"error_log"`

	MaxSize    int `yaml:"max_size"`
	MaxBackups int `yaml:"max_backups"`
	MaxAge     int `yaml:"max_age"`
}

type Path

type Path string

A Path on the filesystem.

type Redis

type Redis struct {
	Address string `yaml:"address"`
	Port    int64  `yaml:"port"`
}

Redis config

type ServerConfig

type ServerConfig struct {
	// Hostname
	Hostname string `yaml:"hostname"`

	// Home Server bind address
	HTTPBind string `yaml:"http_bind"`

	// Home Server HTTPS Bind address
	HTTPSBind string `yaml:"https_bind"`

	// Zap Logger configuration
	Logger LoggerOpts `yaml:"logger"`

	// Global pool of database connections
	DatabaseOptions DatabaseOptions `yaml:"database,omitempty"`

	// Path to the private key which will be used to sign requests and events.
	PrivateKeyPath string `yaml:"private_key"`
	Passphrase     string `yaml:"passphrase"`

	Trillian    Trillian `yaml:"trillian"`
	Redis       Redis    `yaml:"redis"`
	RedisClient radix.Client
}

Global config

type Trillian

type Trillian struct {
	Address string `yaml:"address"`
	Port    int64  `yaml:"port"`

	// Trillian Merkle Tree ID
	TreeID uint `yaml:"tree_id"`
}

Google Trillian Server config

Jump to

Keyboard shortcuts

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