config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package config implements the config interface for the viper config backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Databases    []Database
	Zitadel      ZitadelConfig `mapstructure:"zitadel"`
	Env          string        `mapstructure:"env"`
	JwtSecretKey string        `mapstructure:"jwt_secret_key"`
	TimeZone     string        `mapstructure:"timezone"`
}

Config represents the overall configuration structure

func ConfigFactory

func ConfigFactory(t string, path string, logger logger.ILogger) Config

ConfigFactory creates a Config object based on the provided type and path

type Database

type Database struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Type     string `mapstructure:"type"`
	Name     string `mapstructure:"name"`
	Database string `mapstructure:"database"`
}

Database holds the configuration for database connections

type IConfig

type IConfig interface {
	ReadFile(path string)
	GetConfig() (config Config)
}

IConfig interface defines methods for config management

type ViperConfig

type ViperConfig struct {
	// contains filtered or unexported fields
}

ViperConfig is the viper config backend.

func NewViperConfig

func NewViperConfig(logger logger.ILogger) *ViperConfig

NewViperConfig creates a new viper config backend.

func (*ViperConfig) GetConfig

func (vc *ViperConfig) GetConfig() (Config, error)

GetConfig reads the config file and unmarshals it into the config struct.

func (*ViperConfig) ReadFile

func (vc *ViperConfig) ReadFile(path string)

ReadFile reads the config file from the path.

type ZitadelConfig

type ZitadelConfig struct {
	Domain  string `mapstructure:"domain"`
	Port    uint8  `mapstructure:"port"`
	KeyPath string `mapstructure:"key_path"`
}

ZitadelConfig holds the configuration for Zitadel

Jump to

Keyboard shortcuts

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