config

package
v0.0.0-...-5b4c5eb Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTracerName = "github.com/oinume/lekcije"
)

Variables

View Source
var DefaultVars = &Vars{}

Functions

func IsDevelopmentEnv

func IsDevelopmentEnv() bool

func IsLocalEnv

func IsLocalEnv() bool

func IsProductionEnv

func IsProductionEnv() bool

func LocalLocation

func LocalLocation() *time.Location

func MustProcessDefault

func MustProcessDefault()

func StaticURL

func StaticURL() string

func WebURL

func WebURL() string

func WebURLScheme

func WebURLScheme(r *http.Request) string

Types

type MySQL

type MySQL struct {
	User     string `env:"MYSQL_USER"`
	Password string `env:"MYSQL_PASSWORD"`
	Host     string `env:"MYSQL_HOST"`
	Port     string `env:"MYSQL_PORT"`
	Database string `env:"MYSQL_DATABASE"`
}

type Trace

type Trace struct {
	Enable       bool    `env:"TRACE_ENABLED"`
	Exporter     string  `env:"TRACE_EXPORTER"`
	SamplingRate float64 `env:"TRACE_SAMPLING_RATE"`
	ExporterURL  string  `env:"TRACE_EXPORTER_URL"`
}

type Vars

type Vars struct {
	*MySQL
	*Trace
	NodeEnv                   string `env:"NODE_ENV"`
	ServiceEnv                string `env:"LEKCIJE_ENV" required:"true"`
	GCPProjectID              string `env:"GCP_PROJECT_ID"`
	GCPServiceAccountKey      string `env:"GCP_SERVICE_ACCOUNT_KEY"`
	EnableFetcherHTTP2        bool   `env:"ENABLE_FETCHER_HTTP2" default:"true"`
	EnableStackdriverProfiler bool   `env:"ENABLE_STACKDRIVER_PROFILER"`
	GoogleClientID            string `env:"GOOGLE_CLIENT_ID"`
	GoogleClientSecret        string `env:"GOOGLE_CLIENT_SECRET"`
	GoogleAnalyticsID         string `env:"GOOGLE_ANALYTICS_ID"`
	HTTPPort                  int    `env:"PORT" default:"4001"`
	RollbarAccessToken        string `env:"ROLLBAR_ACCESS_TOKEN"`
	VersionHash               string `env:"VERSION_HASH"`
	DebugSQL                  bool   `env:"DEBUG_SQL"`
	LocalLocation             *time.Location
}

func MustProcess

func MustProcess() *Vars

func Process

func Process() (*Vars, error)

func (*Vars) DBURL

func (v *Vars) DBURL() string

func (*Vars) IsDevelopmentEnv

func (v *Vars) IsDevelopmentEnv() bool

func (*Vars) IsLocalEnv

func (v *Vars) IsLocalEnv() bool

func (*Vars) IsProductionEnv

func (v *Vars) IsProductionEnv() bool

func (*Vars) StaticURL

func (v *Vars) StaticURL() string

func (*Vars) WebURL

func (v *Vars) WebURL() string

func (*Vars) WebURLScheme

func (v *Vars) WebURLScheme(r *http.Request) string

Jump to

Keyboard shortcuts

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