config

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Http struct {
		Port int `env:"HTTP_PORT" env-default:"8080"`
	}
	Discord struct {
		Token string `env:"DISCORD_TOKEN"`
	}
	Database struct {
		Host       string `env:"DATABASE_HOST" env-default:"db"`
		Port       int    `env:"DATABASE_PORT" env-default:"5432"`
		Database   string `env:"DATABASE_DBNAME" env-default:"postgres"`
		Username   string `env:"DATABASE_USERNAME" env-default:"postgres"`
		Password   string `env:"DATABASE_PASSWORD" env-default:"postgres"`
		DisableTLS bool   `env:"DATABASE_DISABLE_TLS" env-default:"true"`
		CertPath   string `env:"DATABASE_CERT_PATH"`
	}
	Redis struct {
		Host     string `env:"REDIS_HOST" env-default:"redis"`
		Port     int    `env:"REDIS_PORT" env-default:"6379"`
		Password string `env:"REDIS_PASSWORD" env-default:"redispassword"`
		Database int    `env:"REDIS_DATABASE" env-default:"0"`
	}
	Metrics struct {
		Host   string `env:"METRICS_HOST" env-default:"metricsclients"`
		Port   int    `env:"METRICS_PORT" env-default:"8086"`
		Bucket string `env:"METRICS_BUCKET" env-default:"rebot"`
		Token  string `env:"METRICS_TOKEN"`
	}
	RabbitMQ struct {
		Host     string `env:"RABBIT_HOST" env-default:"mq"`
		Port     int    `env:"RABBIT_PORT" env-default:"5672"`
		User     string `env:"RABBIT_USER" env-default:"rabbitmq"`
		Password string `env:"RABBIT_PASS" env-default:"rabbitpass"`
	}
	Consul struct {
		Address     string `env:"CONSUL_ADDR" env-default:"consul:8500"`
		ServiceID   UUID   `env:"CONSUL_ID" env-default:""`
		ServiceName string `env:"CONSUL_NAME" env-default:"command"`
	}
}

func GetConfig

func GetConfig() (*Config, error)

GetConfig load config from ENVs or .env file. If config is already loaded, return it.

type UUID

type UUID string

func (*UUID) SetValue

func (u *UUID) SetValue(s string) error

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

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