config

package
v0.0.0-...-844d4e4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDotenv

func LoadDotenv(embedFS embed.FS, resourcePaths map[string]string) error

LoadDotenv is a helper function to load the dotenv file into environment variables

Types

type AppConfig

type AppConfig struct {
	// AppEnv is the application environment that determines `configs/<APP_ENV>.env` to load.
	AppEnv string `env:"APP_ENV" envDefault:"development"`

	// PrimaryDBUri is the primary database URI.
	PrimaryDBUri string `env:"PRIMARY_DB_URI"`

	// ServiceName is the application's service name.
	ServiceName string `env:"SERVICE_NAME" envDefault:"golang-integration-sample"`

	// TracerCollectorAddress is the OpenTelemetry trace collector address.
	TracerCollectorAddress string `env:"TRACER_COLLECTOR_ADDRESS"`

	// NewRelicLicenseKey is the license key for New relic instrumentations
	NewRelicLicenseKey string `env:"NEWRELIC_LICENSE_KEY"`

	HTTPConfig struct {
		// Address is the HTTP server's address.
		Address string `env:"HTTP_ADDRESS"`

		// Enabled is the feature flag
		Enabled bool `env:"HTTP_ENABLED"`
	}

	HTTPSConfig struct {
		// Address is the HTTPS server's address.
		Address string `env:"HTTPS_ADDRESS"`

		// Enabled is the feature flag
		Enabled bool `env:"HTTPS_ENABLED"`
	}

	TwilioConfig struct {
		// Enabled is the feature flag
		Enabled bool `env:"TWILIO_ENABLED"`

		// AccountSID is the twilio account SID value
		AccountSID string `env:"TWILIO_ACCOUNT_SID"`

		// AuthToken is the twilio auth token value
		AuthToken string `env:"TWILIO_AUTH_TOKEN"`

		// VerifyServiceSID is the twilio verification Service SID value
		VerifyServiceSID string `env:"TWILIO_VERIFY_SERVICE_SID"`

		WhatsappPhoneNumber string `env:"TWILIO_WHATSAPP_PHONE_NUMBER"`

		SMSPhoneNumber string `env:"TWILIO_SMS_PHONE_NUMBER"`

		PhoneNumberSID string `env:"TWILIO_PHONE_NUMBER_SID"`
	}
}

AppConfig maps the environment variables into a struct.

func NewConfig

func NewConfig() (AppConfig, error)

NewConfig loads <APP_ENV> into Config struct.

Jump to

Keyboard shortcuts

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