config

package
v0.0.0-...-ef053f8 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Did         string `koanf:"did" yaml:"did"`
	Identifier  string `koanf:"identifier" yaml:"identifier"`
	RefreshJwt  string `koanf:"refresh_jwt" yaml:"refresh_jwt"`
	AccessJwt   string `koanf:"-" yaml:"-"` // do not marshal this field
	AppPassword string `koanf:"-" yaml:"-"` // do not marshal this field
	Path        string `koanf:"-" yaml:"-"` // do not marshal this field
	Server      string `koanf:"server,omitempty" yaml:"server,omitempty"`
	Debug       bool   `koanf:"debug,omitempty" yaml:"debug,omitempty"`
}

func New

func New(path string) (*Config, error)

func (*Config) Exists

func (c *Config) Exists() bool

Checks if the file exists at the specified path.

func (*Config) Load

func (c *Config) Load() error

Load loads the configuration from the specified file path and environment variables. if the file does not exist, it will return an empty Config struct.

Parameters:

  • path: The file path to the YAML configuration file.

Returns:

  • *Config: A pointer to the loaded Config struct.
  • error: An error if any occurred during the loading process.

func (*Config) Save

func (c *Config) Save() error

Jump to

Keyboard shortcuts

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