Documentation
¶
Overview ¶
Package repoconfig is a repo's settings file, .anfra/config.yml: committed, written by hand, and by anfra only through SetString, which changes nothing but the value it sets.
Index ¶
Constants ¶
const FileName = "config.yml"
FileName is the settings file, in the repo's config folder.
Variables ¶
This section is empty.
Functions ¶
func Hint ¶
Hint is how a message names a setting, for a person to find it: ".anfra/config.yml org.url".
func SetString ¶
SetString sets section.key to value in the YAML file at path, as git config sets a key: the file is parsed only to find where things are, and the new file is the old one's bytes with the value's bytes replaced, so comments, order and formatting are untouched; written to a lock file and renamed over the original, so a reader sees one or the other and two writers cannot interleave.
- No file: it is created.
- No section: a block for it is appended at the end, which disturbs nothing above it.
- The key, a scalar on one line: its value's bytes are replaced.
- Anything else (the section without the key, flow style, a value spanning lines): refused, naming the value to set by hand, rather than guessed at.
value must be a plain scalar that reads back as itself; the result is parsed again and checked before it replaces the file.
Types ¶
type Config ¶
type Config struct {
Org struct {
// URL is the org `anfra publish` publishes the repo to, by its address on
// its server. Never a credential.
URL string `yaml:"url"`
} `yaml:"org"`
Apps struct {
// AllowOrigins are the origins the repo's Data Apps may load from beyond
// the SDK's own CDNs, as `anfra serve` runs them. Never published: an org
// holds its own list (AllowedOrigins checks them).
AllowOrigins []string `yaml:"allow_origins"`
} `yaml:"apps"`
}
Config is what anfra reads from the settings file.
func (Config) AllowedOrigins ¶ added in v0.12.0
AllowedOrigins is apps.allow_origins, each an origin a Data App's content policy can take (repoformat.CheckOrigin), or an error naming the first that is not.