config

package
v0.0.0-...-7226b57 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	Address string `yaml:"address"`
	Port    int    `yaml:"port"`
}

DatabaseConfig represents the API configuration section of the configuration file.

type Config

type Config struct {
	Database *DatabaseConfig `yaml:"database"`
	Api      *ApiConfig      `yaml:"api"`
}

Config represents the top-level structure of the configuration file.

func NewConfig

func NewConfig(filePath string) (*Config, error)

NewConfig reads and parses the content at the provided file path into an instance of the Config struct.

type DatabaseConfig

type DatabaseConfig struct {
	Host     string `yaml:"host"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	SSLMode  string `yaml:"ssl_mode"`
}

DatabaseConfig represents the database configuration section of the configuration file.

func (*DatabaseConfig) ConnString

func (dc *DatabaseConfig) ConnString() string

ConnString generates a string to pass to sql.Open to connect to the PostgreSQL database.

Jump to

Keyboard shortcuts

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