config

package
v0.0.0-...-55591ee Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationName = "gopher-town"
)

Variables

This section is empty.

Functions

func Dump

func Dump(w io.Writer) error

func Load

func Load(path string) error

func LoadRemote

func LoadRemote(repo, path string) error

func Logger

func Logger() *log.Logger

func Modules

func Modules() iter.Seq[Module]

Types

type Config

type Config struct {
	Source      string            `toml:"-"`
	Version     int               `toml:"version" default:"1"`
	Includes    []string          `toml:"include,omitempty"`
	System      System            `toml:"system,omitempty"`
	Web         Web               `toml:"web,omitempty"`
	Routes      Routes            `toml:"routes,omitempty"`
	Definitions map[string]Module `toml:"module,omitempty"`
}

func Get

func Get() Config

func New

func New() *Config

New creates a new config and applies the defaults

func Set

func Set() *Config

func (Config) Dump

func (c Config) Dump(w io.Writer) error

Dump an encoded config to a writer

func (*Config) Load

func (c *Config) Load(path string) error

Load a config at the given path

func (Config) Logger

func (c Config) Logger() *log.Logger

Logger gets our configured logger instance

func (Config) Modules

func (c Config) Modules() iter.Seq[Module]

type IncludedConfig

type IncludedConfig struct {
	Module
	Source      string            `toml:"-"`
	Definitions map[string]Module `toml:"module"`
}

type Log

type Log struct {
	Level  string `toml:"level" default:"info"`
	Format string `toml:"format" default:"pretty"`
}

func (Log) GetLogger

func (l Log) GetLogger() *log.Logger

type Module

type Module struct {
	Path        string `toml:"path"`
	Name        string `toml:"name"`
	VCS         string `toml:"vcs" default:"git"`
	Repo        string `toml:"repo"`
	Description string `toml:"description, omitempty"`
}

func (Module) SourceViewText

func (m Module) SourceViewText() string

func (Module) SourceViewURL

func (m Module) SourceViewURL() string

type RemoteConfig

type RemoteConfig struct {
	Repo string
}

type Routes

type Routes struct {
	RoutesDebugDisabled bool   `toml:"routes-debug-disabled,omitempty"`
	RoutesDebug         string `toml:"routes-debug" default:"/.well-known/routes"`

	HealthCheckDisabled bool   `toml:"healthcheck-disabled,omitempty"`
	HealthCheck         string `toml:"healthcheck" default:"/.well-known/ruok"`

	MetricsDisabled bool   `toml:"metrics-disabled,omitempty"`
	Metrics         string `toml:"metrics" default:"/.well-known/metrics"`

	ReadyDisabled bool   `toml:"ready-disabled,omitempty"`
	Ready         string `toml:"ready" default:"/.well-known/ready"`

	Reserved []string `toml:"reserved" default:"[\"/internal\"]"`
}

type System

type System struct {
	Log Log `toml:"log"`
}

type Web

type Web struct {
	Domain string `toml:"domain"`
	Addr   string `toml:"addr" default:"127.0.0.1:8090"`
}

Jump to

Keyboard shortcuts

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