config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Environments
	ENV_ENVIRONMENT string = "ENVIRONMENT"
	ENV_APP_NAME    string = "APP_NAME"
	ENV_APP_TYPE    string = "APP_TYPE"
	ENV_CLOUD       string = "CLOUD"

	ENV_NEW_RELIC_LICENSE           string = "NEW_RELIC_LICENSE"
	ENV_OTEL_EXPORTER_OTLP_ENDPOINT string = "OTEL_EXPORTER_OTLP_ENDPOINT"
	ENV_OTEL_EXPORTER_OTLP_HEADERS  string = "OTEL_EXPORTER_OTLP_HEADERS"

	ENV_PORT                  string = "PORT"
	ENV_SQL_DB_MIGRATION      string = "SQL_DB_MIGRATION"
	ENV_CLOUD_HOST            string = "CLOUD_HOST"
	ENV_CLOUD_REGION          string = "CLOUD_REGION"
	ENV_CLOUD_SECRET          string = "CLOUD_SECRET"
	ENV_CLOUD_TOKEN           string = "CLOUD_TOKEN"
	ENV_CLOUD_DISABLE_SSL     string = "CLOUD_DISABLE_SSL"
	ENV_CACHE_URI             string = "CACHE_URI"
	ENV_CACHE_PASSWORD        string = "CACHE_PASSWORD"
	ENV_SQL_DB_NAME           string = "SQL_DB_NAME"
	ENV_SQL_DB_HOST           string = "SQL_DB_HOST"
	ENV_SQL_DB_PORT           string = "SQL_DB_PORT"
	ENV_SQL_DB_USER           string = "SQL_DB_USER"
	ENV_SQL_DB_PASSWORD       string = "SQL_DB_PASSWORD"
	ENV_SQL_DB_SSL_MODE       string = "SQL_DB_SSL_MODE"
	ENV_SQL_DB_MAX_OPEN_CONNS string = "SQL_DB_MAX_OPEN_CONNS"
	ENV_SQL_DB_MAX_IDLE_CONNS string = "SQL_DB_MAX_IDLE_CONNS"
	ENV_LOG_LEVEL             string = "LOG_LEVEL"

	// Environment values
	ENVIRONMENT_PRODUCTION        string = "production"
	ENVIRONMENT_SANDBOX           string = "sandbox"
	ENVIRONMENT_DEVELOPMENT       string = "development"
	ENVIRONMENT_TEST              string = "test"
	APP_TYPE_SERVICE              string = "service"
	APP_TYPE_SERVERLESS           string = "serverless"
	CLOUD_AWS                     string = "aws"
	CLOUD_AZURE                   string = "azure"
	CLOUD_GCP                     string = "gcp"
	CLOUD_FIREBASE                string = "firebase"
	SQL_DB_CONNECTION_URI_DEFAULT string = "host=%s port=%s user=%s password=%s dbname=%s application_name='%s' sslmode=%s"
	VERSION                              = "v0.0.1"
)

Variables

View Source
var (
	ENVIRONMENT = ""
	APP_NAME    = ""
	APP_TYPE    = ""
	APP_VERSION = ""

	NEW_RELIC_LICENSE           = ""
	OTEL_EXPORTER_OTLP_ENDPOINT = ""
	OTEL_EXPORTER_OTLP_HEADERS  = ""

	PORT = 8080

	LOG_LEVEL            = "info"
	LOG_OUTPUT io.Writer = os.Stdout

	CLOUD             = ""
	CLOUD_HOST        = ""
	CLOUD_REGION      = ""
	CLOUD_SECRET      = ""
	CLOUD_TOKEN       = ""
	CLOUD_DISABLE_SSL = true

	SQL_DB_NAME           = ""
	SQL_DB_CONNECTION_URI = ""
	SQL_DB_MIGRATION      = false
	SQL_DB_MAX_OPEN_CONNS = 10
	SQL_DB_MAX_IDLE_CONNS = 3

	CACHE_URI      = ""
	CACHE_PASSWORD = ""
)

Functions

func IsCloudEnvironment

func IsCloudEnvironment() bool

IsCloudEnvironment returns a boolean if is production or sandbox environment.

func IsDevelopmentEnvironment

func IsDevelopmentEnvironment() bool

IsDevelopmentEnvironment returns a boolean if is development environment.

func IsLocalEnvironment

func IsLocalEnvironment() bool

IsLocalEnvironment returns a boolean if is development or test environment.

func IsProductionEnvironment

func IsProductionEnvironment() bool

IsProductionEnvironment returns a boolean if is production environment.

func IsSandboxEnvironment

func IsSandboxEnvironment() bool

IsSandboxEnvironment returns a boolean if is sandbox environment.

func IsTestEnvironment

func IsTestEnvironment() bool

IsTestEnvironment returns a boolean if is test environment.

func Load

func Load() error

Load loads and validates all environment variables. It's used in app initialization.

Types

This section is empty.

Jump to

Keyboard shortcuts

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