package config
import "github.com/gohugoio/hugo/config"
Index ¶
- Variables
- func FromFileToMap(fs afero.Fs, filename string) (map[string]interface{}, error)
- func GetNumWorkerMultiplier() int
- func GetStringSlicePreserveString(cfg Provider, key string) []string
- func IsValidConfigFilename(filename string) bool
- func RenameKeys(m map[string]interface{})
- func SetBaseTestDefaults(cfg Provider)
- func SetEnvVars(oldVars *[]string, keyValues ...string)
- func SplitEnvVar(v string) (string, string)
- type Build
- type Headers
- type KeyParams
- type Provider
- func FromConfigString(config, configType string) (Provider, error)
- func FromFile(fs afero.Fs, filename string) (Provider, error)
- func LoadConfigFromDir(sourceFs afero.Fs, configDir, environment string) (Provider, []string, error)
- func New() Provider
- func NewCompositeConfig(base, layer Provider) Provider
- func NewFrom(params maps.Params) Provider
- type Redirect
- type Server
- func DecodeServer(cfg Provider) (*Server, error)
- func (s *Server) MatchHeaders(pattern string) []types.KeyValueStr
- func (s *Server) MatchRedirect(pattern string) Redirect
- type Sitemap
Variables ¶
var ( // ConfigRootKeysSet contains all of the config map root keys. ConfigRootKeysSet = map[string]bool{ "build": true, "caches": true, "cascade": true, "frontmatter": true, "languages": true, "imaging": true, "markup": true, "mediatypes": true, "menus": true, "minify": true, "module": true, "outputformats": true, "params": true, "permalinks": true, "related": true, "sitemap": true, "privacy": true, "security": true, "taxonomies": true, } // ConfigRootKeys is a sorted version of ConfigRootKeysSet. ConfigRootKeys []string )
var ( ValidConfigFileExtensions = []string{"toml", "yaml", "yml", "json"} )
Functions ¶
func FromFileToMap ¶
FromFileToMap is the same as FromFile, but it returns the config values as a simple map.
func GetNumWorkerMultiplier ¶
func GetNumWorkerMultiplier() int
GetNumWorkerMultiplier returns the base value used to calculate the number of workers to use for Hugo's parallel execution. It returns the value in HUGO_NUMWORKERMULTIPLIER OS env variable if set to a positive integer, else the number of logical CPUs.
func GetStringSlicePreserveString ¶
GetStringSlicePreserveString returns a string slice from the given config and key. It differs from the GetStringSlice method in that if the config value is a string, we do not attempt to split it into fields.
func IsValidConfigFilename ¶
IsValidConfigFilename returns whether filename is one of the supported config formats in Hugo.
func RenameKeys ¶
func RenameKeys(m map[string]interface{})
RenameKeys renames config keys in m recursively according to a global Hugo alias definition.
func SetBaseTestDefaults ¶
func SetBaseTestDefaults(cfg Provider)
SetBaseTestDefaults provides some common config defaults used in tests.
func SetEnvVars ¶
SetEnvVars sets vars on the form key=value in the oldVars slice.
func SplitEnvVar ¶
Types ¶
type Build ¶
type Build struct { UseResourceCacheWhen string // never, fallback, always. Default is fallback // When enabled, will collect and write a hugo_stats.json with some build // related aggregated data (e.g. CSS class names). WriteStats bool // Can be used to toggle off writing of the intellinsense /assets/jsconfig.js // file. NoJSConfigInAssets bool }
Build holds some build related configuration.
func DecodeBuild ¶
func (Build) UseResourceCache ¶
type Headers ¶
type KeyParams ¶
type Provider ¶
type Provider interface { GetString(key string) string GetInt(key string) int GetBool(key string) bool GetParams(key string) maps.Params GetStringMap(key string) map[string]interface{} GetStringMapString(key string) map[string]string GetStringSlice(key string) []string Get(key string) interface{} Set(key string, value interface{}) Merge(key string, value interface{}) SetDefaults(params maps.Params) SetDefaultMergeStrategy() WalkParams(walkFn func(params ...KeyParams) bool) IsSet(key string) bool }
Provider provides the configuration settings for Hugo.
func FromConfigString ¶
FromConfigString creates a config from the given YAML, JSON or TOML config. This is useful in tests.
func FromFile ¶
FromFile loads the configuration from the given filename.
func LoadConfigFromDir ¶
func LoadConfigFromDir(sourceFs afero.Fs, configDir, environment string) (Provider, []string, error)
func New ¶
func New() Provider
New creates a Provider backed by an empty maps.Params.
func NewCompositeConfig ¶
NewCompositeConfig creates a new composite Provider with a read-only base and a writeable layer.
func NewFrom ¶
NewFrom creates a Provider backed by params.
type Redirect ¶
func (Redirect) IsZero ¶
type Server ¶
type Server struct { Headers []Headers Redirects []Redirect // contains filtered or unexported fields }
Config for the dev server.
func DecodeServer ¶
func (*Server) MatchHeaders ¶
func (s *Server) MatchHeaders(pattern string) []types.KeyValueStr
func (*Server) MatchRedirect ¶
type Sitemap ¶
Sitemap configures the sitemap to be generated.
func DecodeSitemap ¶
Source Files ¶
commonConfig.go compositeConfig.go configLoader.go configProvider.go defaultConfigProvider.go docshelper.go env.go
Directories ¶
Path | Synopsis |
---|---|
config/privacy | |
config/security | |
config/services |
- Version
- v0.91.2
- Published
- Dec 23, 2021
- Platform
- darwin/amd64
- Imports
- 20 packages
- Last checked
- 30 minutes ago –
Tools for package owners.