appconfig

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64EncodedJWTSecret

type Base64EncodedJWTSecret []byte

func (*Base64EncodedJWTSecret) Decode

func (c *Base64EncodedJWTSecret) Decode(value string) (err error)

type Config

type Config struct {
	// ConfigSpec is the configuration specification injected to the config.
	ConfigSpec

	// AppEnv is the application context
	AppEnv appenv.Ctx
}

func Parse

func Parse(ctx appenv.Ctx) (*Config, error)

type ConfigLogLevel

type ConfigLogLevel zerolog.Level

func (*ConfigLogLevel) Decode

func (c *ConfigLogLevel) Decode(value string) error

type ConfigSpec

type ConfigSpec struct {
	// DatabaseURL is the URL to the PostgreSQL database.
	DatabaseURL string `split_words:"true" required:"true"`

	// RedisURL is the URL to the Redis database.
	RedisURL string `split_words:"true" required:"true"`

	// ServiceListenAddress is the address that the Fiber HTTP server will listen on.
	ServiceListenAddress string `split_words:"true" required:"true" default:":3000"`

	// LogJSONStdout is the flag to enable JSON logging to stdout and disable logging to file.
	LogJSONStdout bool `split_words:"true" required:"true" default:"false"`

	// LogLevel is the log level. Valid values are: trace, debug, info, warn, error, fatal, panic.
	LogLevel ConfigLogLevel `split_words:"true" required:"true" default:"info"`

	// JWTPublicKey is the public key used to verify the JWT token.
	JWTPublicKey []byte `split_words:"true" required:"true"`

	// JWTPrivateKey is the private key used to sign the JWT token.
	JWTPrivateKey []byte `split_words:"true" required:"true"`

	// JWTExpiration is the expiration time of the JWT token. (default: 2 weeks (14 days, 336 hours))
	JWTExpiration time.Duration `split_words:"true" required:"true" default:"336h"`

	// JWTAutoRenewalTime is the time before expiration that a new JWT token will be
	// issued automatically to the client via the header that is the same as the
	// one used to authenticate. (default: 1 week (7 days, 168 hours))
	JWTAutoRenewalTime time.Duration `split_words:"true" required:"true" default:"168h"`

	// TurnstileSecret is the secret used to verify the turnstile response.
	TurnstileSecret string `split_words:"true" required:"true"`

	// ResendApiKey is the API key used to send emails via Resend.
	ResendApiKey string `split_words:"true" required:"true"`

	// PasswordResetTokenTTL is the time to live of the password reset token.
	PasswordResetTokenTTL time.Duration `split_words:"true" required:"true" default:"1h"`
}

ConfigSpec is the configuration specification.

Jump to

Keyboard shortcuts

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