config

package
v0.1.4-alpha-deployment1 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"`
	}
	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"`
		CetrPath   string `env:"DATABASE_CERT_PATH"`
	}
	Consul struct {
		Address     string `env:"CONSUL_ADDR" env-default:"consul:8500"`
		ServiceHost string `env:"CONSUL_SERVICE_HOST"`
		ServiceID   UUID   `env:"CONSUL_ID" env-default:""`
		ServiceName string `env:"CONSUL_NAME" env-default:"api"`
	}
	Influx struct {
		Host   string `env:"INFLUX_HOST" env-default:"influxdb:8086"`
		Token  string `env:"INFLUX_TOKEN" env-required:""`
		Org    string `env:"INFLUX_ORG" env-required:""`
		Bucket string `env:"INFLUX_BUCKET" env-required:""`
	}
}

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