commons

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AMQPPortDefault         int    = 5672
	IRODSPortDefault        int    = 1247
	VarnishURLPrefixDefault string = "http://127.0.0.1:6081/"
	LogFilePathDefault      string = "/tmp/purgeman.log"
)

Variables

This section is empty.

Functions

func GetServiceVersion

func GetServiceVersion() string

GetServiceVersion returns service version in string

func GetVersionJSON

func GetVersionJSON() (string, error)

GetVersionJSON returns VersionInfo object in JSON string

Types

type Config

type Config struct {
	AMQPHost     string `envconfig:"PURGEMAN_AMQP_HOST" yaml:"amqp_host"`
	AMQPPort     int    `envconfig:"PURGEMAN_AMQP_PORT" yaml:"amqp_port"`
	AMQPVHost    string `envconfig:"PURGEMAN_AMQP_VHOST" yaml:"amqp_vhost"`
	AMQPExchange string `envconfig:"PURGEMAN_AMQP_EXCHANGE" yaml:"amqp_exchange"`
	AMQPQueue    string `envconfig:"PURGEMAN_AMQP_QUEUE" yaml:"amqp_queue"`
	AMQPUsername string `envconfig:"PURGEMAN_AMQP_USERNAME" yaml:"amqp_username,omitempty"`
	AMQPPassword string `envconfig:"PURGEMAN_AMQP_PASSWORD" yaml:"amqp_password,omitempty"`

	IRODSHost     string `envconfig:"PURGEMAN_IRODS_HOST" yaml:"irods_host"`
	IRODSPort     int    `envconfig:"PURGEMAN_IRODS_PORT" yaml:"irods_port"`
	IRODSUsername string `envconfig:"PURGEMAN_IRODS_USERNAME" yaml:"irods_username,omitempty"`
	IRODSPassword string `envconfig:"PURGEMAN_IRODS_PASSWORD" yaml:"irods_password,omitempty"`
	IRODSZone     string `envconfig:"PURGEMAN_IRODS_ZONE" yaml:"irods_zone"`

	VarnishHostsOverride []string `envconfig:"PURGEMAN_VARNISH_HOSTS_OVERRIDE" yaml:"varnish_hosts_override"`
	VarnishURLPrefixes   []string `envconfig:"PURGEMAN_VARNISH_URLS" yaml:"varnish_urls"`

	LogPath string `envconfig:"PURGEMAN_LOG_PATH" yaml:"log_path,omitempty"`

	Foreground   bool `yaml:"foreground,omitempty"`
	ChildProcess bool `yaml:"childprocess,omitempty"`
}

Config holds the parameters list which can be configured

func NewConfigFromENV

func NewConfigFromENV() (*Config, error)

NewConfigFromENV creates Config from Environmental Variables

func NewConfigFromYAML

func NewConfigFromYAML(yamlBytes []byte) (*Config, error)

NewConfigFromYAML creates Config from YAML

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig creates DefaultConfig

func (*Config) Validate

func (config *Config) Validate() error

Validate validates configuration

type VersionInfo

type VersionInfo struct {
	ServiceVersion string `json:"serviceVersion"`
	GitCommit      string `json:"gitCommit"`
	BuildDate      string `json:"buildDate"`
	GoVersion      string `json:"goVersion"`
	Compiler       string `json:"compiler"`
	Platform       string `json:"platform"`
}

VersionInfo object contains version related info

func GetVersion

func GetVersion() VersionInfo

GetVersion returns VersionInfo object

Jump to

Keyboard shortcuts

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