config

package
v0.0.0-...-f2c6537 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminConfig

type AdminConfig struct {
	Email    string `env:"ADMIN_EMAIL" env-default:"admin@admin.com"`
	Password string `env:"ADMIN_PASSWORD" env-default:"admin"`
}

type Config

type Config struct {
	Db      DbConfig
	Service ServiceConfig
	Tracing TracingConfig
	Jwt     JwtConfig
	Admin   AdminConfig
	Dev     DevConfig
}

func NewConfig

func NewConfig() *Config

Read the environment variables into a `Config` struct.

type DbConfig

type DbConfig struct {
	Name     string `env:"DB_NAME" env-default:"postgres"`
	User     string `env:"DB_USER" env-default:"postgres"`
	Password string `env:"DB_PASSWORD" env-default:"postgres"`
	Host     string `env:"DB_HOST" env-default:"localhost"`
	Port     string `env:"DB_PORT" env-default:"5432"`
	SSLMode  string `env:"DB_SSLMODE" env-default:"disable"`
}

type DevConfig

type DevConfig struct {
	MockEnabled bool `env:"DEV_MOCK_ENABLED" env-default:"false"`
}

type JwtConfig

type JwtConfig struct {
	SecretKey  string `env:"JWT_SECRET_KEY" env-default:"V3RY_S3CR3T_K3Y"`
	CookieName string `env:"JWT_COOKIE_NAME" env-default:"token"`
	HeaderName string `env:"JWT_HEADER_NAME" env-default:"Authorization"`
}

type ServiceConfig

type ServiceConfig struct {
	API struct {
		Host string `env:"SERVICE_API_HOST" env-default:"localhost"`
		Port int    `env:"SERVICE_API_PORT" env-default:"1111"`
	}
	Auth struct {
		Host string `env:"SERVICE_AUTH_HOST" env-default:"localhost"`
		Port int    `env:"SERVICE_AUTH_PORT" env-default:"2222"`
	}
	Speaker struct {
		Host string `env:"SERVICE_SPEAKER_HOST" env-default:"localhost"`
		Port int    `env:"SERVICE_SPEAKER_PORT" env-default:"3333"`
	}
	Event struct {
		Host string `env:"SERVICE_EVENT_HOST" env-default:"localhost"`
		Port int    `env:"SERVICE_EVENT_PORT" env-default:"4444"`
	}
	Session struct {
		Host string `env:"SERVICE_SESSION_HOST" env-default:"localhost"`
		Port int    `env:"SERVICE_SESSION_PORT" env-default:"5555"`
	}
}

type TracingConfig

type TracingConfig struct {
	Enabled bool   `env:"TRACING_ENABLED" env-default:"false"`
	Host    string `env:"TRACING_HOST" env-default:"localhost"`
}

Jump to

Keyboard shortcuts

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