config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 0700 is the permission for the configuration directory
	ConfigurationDirPerm  = 0700
	ConfigurationFilePerm = 0600
)

Variables

View Source
var (
	ErrConfigurationNotFound = errors.New("configuration not found")
	ErrInvalidToken          = errors.New("token is invalid")
	ErrInvalidEndpoint       = errors.New("endpoint is invalid")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Token    string `yaml:"token"`
	Endpoint string `yaml:"endpoint"`
	// contains filtered or unexported fields
}

Config is the configuration for the application.

func NewConfig

func NewConfig() *Config

NewConfig creates a new configuration for the application

func (*Config) IsConfigValid

func (c *Config) IsConfigValid() bool

IsConfigValid checks if the configuration is valid

func (*Config) LoadConfigFromEnvVar

func (c *Config) LoadConfigFromEnvVar()

LoadConfigFromEnvVar loads the configuration from the environment variables

func (*Config) LoadConfigFromFile

func (c *Config) LoadConfigFromFile(filename string) error

LoadConfigFromFile loads the configuration from a file

func (*Config) LoadConfiguration

func (c *Config) LoadConfiguration() error

LoadConfiguration loads the configuration from the environment variables first If the configuration is not valid, it tries to load the configuration from the $HOME/.eph.yml file

func (*Config) SaveConfiguration

func (c *Config) SaveConfiguration() error

func (*Config) SetHomedir

func (c *Config) SetHomedir(homedir string)

SetHomedir sets the homedir variable It is used for testing purposes

Jump to

Keyboard shortcuts

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