config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config provides configuration management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig added in v0.0.4

func DefaultConfig()

DefaultConfig sets the default values for the configuration

func GetDbURI added in v0.0.4

func GetDbURI() string

GetDbURI returns a database connection string

func GetServerAddress added in v0.0.4

func GetServerAddress() string

GetServerAddress returns the address string to bind the service to

func InitConfig added in v0.0.4

func InitConfig(path string)

InitConfig initializes the configuration

func Random added in v0.0.4

func Random(length int) (string, error)

Random returns a random string of the given length

Types

type K added in v0.0.4

type K string

K is a type alias for string

const (
	// ServiceHost is the host to bind the service to
	ServiceHost K = `service.host`
	// ServicePort is the port to bind the service to
	ServicePort K = `service.port`
	// ServiceApiPrefix is the prefix to use for the API set to "" for /
	ServiceApiPrefix K = `service.api_prefix`

	// ServiceJWTSigningMethod is the signing method to use for JWT
	ServiceJWTSigningMethod K = `service.jwt.signing_method`
	// ServiceJWTSigningSecret is the secret to use for JWT (only for HS256)
	ServiceJWTSigningSecret K = `service.jwt.signing_secret`
	// ServiceJWTSigningKey is the key to use for JWT (only for RS256)
	ServiceJWTSigningKey K = `service.jwt.signing_key`
	// ServiceJWTPublicKey is the public key to use for JWT (only for RS256)
	ServiceJWTPublicKey K = `service.jwt.public_key`
	// ServiceJWTRefreshSigningSecret is the secret to use for JWT refresh token (only for HS256)
	ServiceJWTRefreshSigningSecret K = `service.jwt.refresh_signing_secret`
	// ServiceJWTRefreshSigningKey is the key to use for JWT refresh token (only for RS256)
	ServiceJWTRefreshSigningKey K = `service.jwt.refresh_signing_key`
	// ServiceJWTRefreshPublicKey is the public key to use for JWT refresh token (only for RS256)
	ServiceJWTRefreshPublicKey K = `service.jwt.refresh_public_key`

	// DatabaseHost is the host to connect to the database
	DatabaseHost K = `database.host`
	// DatabasePort is the port to connect to the database
	DatabasePort K = `database.port`
	// DatabaseUsername is the username to connect to the database
	DatabaseUsername K = `database.username`
	// DatabasePassword is the password to connect to the database
	DatabasePassword K = `database.password`
	// DatabaseName is the name of the database to connect to
	DatabaseName K = `database.name`
	// DatabaseAutoMigration is whether to automatically apply the migrations to the database
	DatabaseAutoMigration K = `database.auto_migration`

	// RedisHost is the host to connect to the redis
	RedisHost K = `redis.host`
	// RedisPort is the port to connect to the redis
	RedisPort K = `redis.port`
	// RedisPassword is the password to connect to the redis
	RedisPassword K = `redis.password`
	// RedisDatabase is the database to connect to the redis
	RedisDatabase K = `redis.database`
)

func (K) Get added in v0.0.4

func (k K) Get() interface{}

Get returns the raw value of the key

func (K) GetBool added in v0.0.4

func (k K) GetBool() bool

GetBool returns the value of the key as a bool

func (K) GetInt added in v0.0.4

func (k K) GetInt() int

GetInt returns the value of the key as an int

func (K) GetString added in v0.0.4

func (k K) GetString() string

GetString returns the value of the key as a string

func (K) Set added in v0.0.4

func (k K) Set(value interface{})

Set sets the value of the key

Jump to

Keyboard shortcuts

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