Documentation ¶
Overview ¶
Copyright 2021 Wei (Sam) Wang <sam.wang.0723@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
View Source
const ( DbUsername = "DB_USERNAME" DbPassword = "DB_PASSWD" RedisPassword = "REDIS_PASSWD" SmartProxy = "SMART_PROXY" JwtSecret = "JWT_SECRET" Recaptcha = "RECAPTCHA_SECRET" EnvCoreKey = "ENVIRONMENT" EnvLocal = "local" EnvDev = "dev" EnvStaging = "staging" EnvProd = "prod" )
Variables ¶
View Source
var JwtClaimsKey = contextKey("jwtClaims")
Functions ¶
func GetCurrentEnv ¶
func GetCurrentEnv() string
func IsMigrationDown ¶
func IsMigrationDown() bool
Types ¶
type Config ¶
type Config struct { Log struct { Level string `yaml:"level"` } `yaml:"log"` JwtSecret string RecaptchaSecret string Kafka struct { GroupID string `yaml:"groupId"` Brokers []string `yaml:"brokers"` Topics []string `yaml:"topics"` } `yaml:"kafka"` RedisCache struct { Master string `yaml:"master"` Password string `yaml:"password"` SentinelAddrs []string `yaml:"sentinelAddrs"` } `yaml:"redis"` Server struct { Name string `yaml:"name"` Host string `yaml:"host"` Version string `yaml:"version"` Port int `yaml:"port"` GrpcPort int `yaml:"grpcPort"` } `yaml:"server"` ElasticSearch struct { Host string `yaml:"host"` Port int `yaml:"port"` HealthCheckInterval int `yaml:"healthCheckInterval"` } `yaml:"elasticsearch"` Database struct { User string `yaml:"user"` Password string `yaml:"password"` Host string `yaml:"host"` Database string `yaml:"database"` Port string `yaml:"port"` MaxLifetime int `yaml:"maxLifetime"` MaxIdleConns int `yaml:"maxIdleConns"` MaxOpenConns int `yaml:"maxOpenConns"` } `yaml:"database"` Replica struct { User string `yaml:"user"` Password string `yaml:"password"` Host string `yaml:"host"` Database string `yaml:"database"` Port int `yaml:"port"` MaxLifetime int `yaml:"maxLifetime"` MinIdleConns int `yaml:"minIdleConns"` MaxOpenConns int `yaml:"maxOpenConns"` } `yaml:"replica"` }
func GetCurrentConfig ¶
func GetCurrentConfig() *Config
Click to show internal directories.
Click to hide internal directories.