Documentation ¶
Index ¶
- func BQConn(env Environment) error
- func DBConn(env Environment) (*sql.DB, error)
- func DLMConn(env Environment) (*dlm.DLM, error)
- func ESConn(env Environment) (*elastic.Client, error)
- func Merge(dest interface{}, values ...interface{}) error
- func OverwriteMerge(dest interface{}, values ...interface{}) error
- func RDBConn(env Environment) (*pool.Pool, error)
- type Env
- type Environment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DLMConn ¶
func DLMConn(env Environment) (*dlm.DLM, error)
DLMConn returns distributed lock manager pool
func ESConn ¶
func ESConn(env Environment) (*elastic.Client, error)
ESConn returns established connection
func Merge ¶
func Merge(dest interface{}, values ...interface{}) error
Merge assembles []map[string]interface{} to dest
func OverwriteMerge ¶
func OverwriteMerge(dest interface{}, values ...interface{}) error
OverwriteMerge assembles []map[string]interface{} to dest
Types ¶
type Env ¶
type Env struct { // GWURI listens a port as grpc gateway server GWURI string `envconfig:"APICUBE_URI" default:"http://0.0.0.0:50000"` // URI listens a port as grpc server URI string `envconfig:"APICUBE_URI" default:"grpc://0.0.0.0:50001"` // RDBURI is set server host and port with db number, that's like DSN RDBURI string `envconfig:"APICUBE_RDBURI" default:"redis://127.0.0.1:6379/10"` // DLMURI is set distributed lock server host and port with db number, that's like DSN DLMURI string `envconfig:"APICUBE_DLMURI" default:"redis://127.0.0.1:6379/9"` // URI is set server host and port, which means the same as FQDN ESURI string `envconfig:"APICUBE_ESURL" default:"http://127.0.0.1:9200"` // FURI is storage uri e.g. s3://data_bucket/path/data.flac or file:// FURI string `envconfig:"APICUBE_FURI" default:"file://./storage/data.flac"` // BQGSURI is bigquery loader storage BQGSURI string `envconfig:"APICUBE_BQGSURI" default:"gs://apicube-bigquery-development/apicube/table.json"` // DSN is mysql data source name DSN string `envconfig:"APICUBE_DSN" default:"root:@tcp(127.0.0.1:3306)/apicube?parseTime=true&loc=Asia%2FTokyo"` // Mode defines project environment mode Mode string `envconfig:"APICUBE_MODE" default:"development"` // Debug controls Debug string `envconfig:"APICUBE_DEBUG" default:""` // debug|pprof|something // IPFilter blocks not allowed ipaddresses IPFilter string `envconfig:"APICUBE_IPFILTER" default:"0.0.0.0,1.1.1.1"` // GCProject: GOOGLE_PROJECT, GCLOUD_PROJECT GCProject string `envconfig:"GOOGLE_PROJECT" default:""` // SentryDSN: SENTRY_DSN SentryDSN string `envconfig:"SENTRY_DSN" default:""` }
Env defines for configuration
type Environment ¶
type Environment interface { // IsProd returns determined product environment mode IsProd() bool // IsSentry returns IsSentry() bool // IsDebug returns IsDebug() bool // IsProfiler returns IsProfiler() bool // IsUserFilter returns IsUserFilter() bool // IsAuth returns IsAuth(ipaddr string) bool // EnvString gets property variable EnvString(prop string) string // must be implement in children // EnvInt gets property variable EnvInt(prop string) int // must be implement in children }
Environment defines public interfaces
Click to show internal directories.
Click to hide internal directories.