Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ServiceConfig ¶
type ServiceConfig struct { BasePath string `env:"BASE_PATH"` ServiceVersion string `env:"SERIVCE_VERSION" envDefault:"0.0.0"` DatabaseHost string `env:"DB_HOST"` DatabaseDriver string `env:"DB_DRIVER"` DatabaseUser string `env:"DB_USER"` DatabasePassword string `env:"PGPASSWORD"` DatabasePort int64 `env:"DB_PORT"` DatabaseName string `env:"DB_NAME"` // the actual database name to connect to FixturesPath string `env:"FIXTURES_PATH" envDefault:"./testdata"` // only used in test MigrationsPath string `env:"MIGRATIONS_PATH" envDefault:"./db/migrations"` LogLevel string `env:"LOG_LEVEL" envDefault:"debug"` LogStyle string `env:"LOG_STYLE" envDefault:"prettyjson"` Port int64 `env:"PORT" envDefault:"8080"` // Configure the static fileserver StaticContentPath string `env:"STATIC_CONTENT_PATH"` // Swagger SwaggerFilePath string `env:"SWAGGER_FILE_PATH"` APIPath string `env:"SWAGGER_API_PATH"` SwaggerPath string `env:"SWAGGER_PATH"` // HealthCheck HealthCheckPath string `env:"HEALTH_PATH" envDefault:"/GetServiceStatus"` // Singleton logrus instance Logger *logrus.Entry // Oauth BcryptCost int `env:"BCRYPT_COST" envDefault:"5"` TokenExpirationTime string `env:"JWT_EXPIRATION_DURATION" envDefault:"4h"` JwtPrivateKey string `env:"OAUTH_JWT_PRIVATE_KEY"` JwtPublicKey string `env:"OAUTH_JWT_PUBLIC_KEY"` // contains filtered or unexported fields }
func GetServiceConfig ¶
func GetServiceConfig() (config *ServiceConfig, err error)
func (*ServiceConfig) GetDbConn ¶
func (cfg *ServiceConfig) GetDbConn() *sqlx.DB
func (*ServiceConfig) GetJWTKeys ¶
func (cfg *ServiceConfig) GetJWTKeys() (*rsa.PrivateKey, *rsa.PublicKey)
func (*ServiceConfig) GetPublicKey ¶
func (cfg *ServiceConfig) GetPublicKey() *rsa.PublicKey
func (*ServiceConfig) GetTokenExpirationDuration ¶
func (cfg *ServiceConfig) GetTokenExpirationDuration() time.Duration
GetTokenExpirationDuration converts the JWT_EXPIRATION_DURATION environment variable to a time.Duration, substituting a safe default if the env var is malformed or missing.
Click to show internal directories.
Click to hide internal directories.