config

package
v0.0.0-...-09dfd77 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

package config implements methods that handle reading and writing from a config.toml file in the root of a project. This will be the root command. It passes the config file attrs into context.

Index

Constants

View Source
const ConfKey string = "CONFIG"
View Source
const LoggerKey string = "LOGGER"

Variables

View Source
var DefaultConfigFile []byte

Functions

func BuildFlags

func BuildFlags(show bool) []cli.Flag

func MergeFlags

func MergeFlags(flag cli.Flag, show bool) []cli.Flag

MergeFlags allows other commands to use the build commands directory paths to run while including their own flags by returning a new list of Flags

Types

type Config

type Config struct {
	Metadata Meta       `toml:"meta"`
	Theme    Theme      `toml:"theme"`
	Options  DevOptions `toml:"dev"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

func OpenConfig

func OpenConfig(p string) *Config

func (Config) UpdateLogLevel

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

type DevOptions

type DevOptions struct {
	Port        int32  `toml:"port"`
	StaticDir   string `toml:"static_dir"`
	TemplateDir string `toml:"template_dir"`
	ContentDir  string `toml:"content_dir"`
	BuildDir    string `toml:"build_dir"`
	Level       string `toml:"level"`
}

func (DevOptions) GetStaticPath

func (d DevOptions) GetStaticPath() string

type Meta

type Meta struct {
	Name        string   `toml:"name"`
	Description string   `toml:"description"`
	Keywords    []string `toml:"keywords"`
	URL         string   `toml:"URL"`
}

type Theme

type Theme struct {
	Light string `toml:"light"`
	Dark  string `toml:"dark"`
}

Jump to

Keyboard shortcuts

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