config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigFileDir is the directory of the configuration file.
	ConfigFileDir = "."

	// ConfigFileName is the name of the configuration file.
	ConfigFileName = "gic.config"

	// ConfigFileType is the type of the configuration file.
	ConfigFileType = "yaml"
)

Variables

View Source
var GitHubToken string

Functions

func CompileTimeTemplate added in v0.6.0

func CompileTimeTemplate(datetime time.Time, template string) string

compile compiles a template with the given datetime. %Y - Year with century as a decimal number. %m - Month as a decimal number [01,12]. %d - Day of the month as a decimal number [01,31]. %H - Hour (24-hour clock) as a decimal number [00,23]. %M - Minute as a decimal number [00,59]. %S - Second as a decimal number [00,59].

func Generate

func Generate() error

Generate generates a configuration file.

func GetConfigPath

func GetConfigPath() string

func Ptr added in v1.0.0

func Ptr[T any](v T) *T

func Write added in v1.0.0

func Write(conf Config) error

Write writes the configuration file using the canonical schema.

Types

type Config

type Config struct {
	GitHub *GitHubConfig `yaml:"github" mapstructure:"github"`
	Output *OutputConfig `yaml:"output" mapstructure:"output"`
	Hugo   *HugoConfig   `yaml:"hugo,omitempty" mapstructure:"hugo"`
}

func Get

func Get() (Config, error)

Get returns a configuration. If the configuration is not loaded, it loads it.

func NewConfig added in v0.6.0

func NewConfig() *Config

func Reload added in v1.0.0

func Reload() (Config, error)

Reload clears the cached config and reloads it from disk.

func (*Config) WarnDeprecatedOptions added in v0.6.0

func (c *Config) WarnDeprecatedOptions() bool

type GitHubConfig

type GitHubConfig struct {
	Username   string `yaml:"username" mapstructure:"username"`
	Repository string `yaml:"repository" mapstructure:"repository"`
}

func NewGitHubConfig added in v0.6.0

func NewGitHubConfig() *GitHubConfig

func (*GitHubConfig) RepositoryURL

func (c *GitHubConfig) RepositoryURL() string

type HugoConfig

type HugoConfig struct {
	Content   *HugoContentConfig   `yaml:"content,omitempty" mapstructure:"content"`
	Images    *HugoImagesConfig    `yaml:"images,omitempty" mapstructure:"images"`
	Bundle    string               `yaml:"bundle,omitempty" mapstructure:"bundle"`
	Directory *HugoDirectoryConfig `yaml:"directory,omitempty" mapstructure:"directory"`
	Filename  *HugoFilenameConfig  `yaml:"filename,omitempty" mapstructure:"filename"`
	Url       *HugoURLConfig       `yaml:"url,omitempty" mapstructure:"url"`
}

type HugoContentConfig added in v1.0.0

type HugoContentConfig struct {
	Directory string `yaml:"directory" mapstructure:"directory"`
	Filename  string `yaml:"filename" mapstructure:"filename"`
}

type HugoDirectoryConfig

type HugoDirectoryConfig struct {
	Articles string `yaml:"articles" mapstructure:"articles"`
	Images   string `yaml:"images" mapstructure:"images"`
}

type HugoFilenameConfig added in v0.6.0

type HugoFilenameConfig struct {
	Articles string `yaml:"articles" mapstructure:"articles"`
	Images   string `yaml:"images" mapstructure:"images"`
}

type HugoImagesConfig added in v1.0.0

type HugoImagesConfig struct {
	Directory string `yaml:"directory" mapstructure:"directory"`
	Filename  string `yaml:"filename" mapstructure:"filename"`
	URL       string `yaml:"url" mapstructure:"url"`
}

type HugoURLConfig

type HugoURLConfig struct {
	AppendSlash bool   `yaml:"appendSlash,omitempty" mapstructure:"appendSlash"`
	Images      string `yaml:"images" mapstructure:"images"`
}

type OutputArticlesConfig added in v1.0.0

type OutputArticlesConfig struct {
	Directory string `yaml:"directory" mapstructure:"directory"`
	Filename  string `yaml:"filename" mapstructure:"filename"`
}

func NewOutputArticlesConfig added in v1.0.0

func NewOutputArticlesConfig() *OutputArticlesConfig

type OutputConfig added in v1.0.0

type OutputConfig struct {
	Articles *OutputArticlesConfig `yaml:"articles" mapstructure:"articles"`
	Images   *OutputImagesConfig   `yaml:"images" mapstructure:"images"`
}

func NewOutputConfig added in v1.0.0

func NewOutputConfig() *OutputConfig

type OutputImagesConfig added in v1.0.0

type OutputImagesConfig struct {
	Directory string  `yaml:"directory" mapstructure:"directory"`
	Filename  string  `yaml:"filename" mapstructure:"filename"`
	BaseURL   *string `yaml:"url" mapstructure:"url"`
}

func NewOutputImagesConfig added in v1.0.0

func NewOutputImagesConfig() *OutputImagesConfig

func (*OutputImagesConfig) URL added in v1.0.0

func (c *OutputImagesConfig) URL() string

Jump to

Keyboard shortcuts

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