Documentation
¶
Overview ¶
Package config finds and reads the repo-local flagsmith.json.
Index ¶
Constants ¶
const FileName = "flagsmith.json"
FileName is the project config file discovered in the working tree.
Variables ¶
var ErrServerSideKey = errors.New("`environment` holds a server-side key, which is a secret")
ErrServerSideKey means the file's `environment` field holds a server-side (ser.) key, which is a secret and must not be committed.
Functions ¶
Types ¶
type File ¶
type File struct {
Schema string `json:"$schema,omitempty"`
Project *Ref `json:"project,omitempty"`
Organisation *Ref `json:"organisation,omitempty"`
Environment string `json:"environment,omitempty"`
APIURL string `json:"apiUrl,omitempty"`
SDKAPIURL string `json:"sdkApiUrl,omitempty"`
// Extra holds unrecognised fields verbatim so they survive a Load/Save
// round trip instead of being silently dropped — a newer file edited by an
// older CLI, say. Not covered by the struct tags: MarshalJSON re-emits it
// after the known fields.
Extra map[string]json.RawMessage `json:"-"`
}
File is the parsed flagsmith.json. Zero values mean "not set".
func Load ¶
Load reads and validates a flagsmith.json. Unknown fields produce warnings, not errors, for forward compatibility; a server-side key in `environment` is an error — those are secrets and never belong in a committed file.
func (File) MarshalJSON ¶
MarshalJSON emits the known fields in their declared order, then appends any Extra fields so a Load/Save round trip preserves them.
type Ref ¶
Ref is a project or organisation reference: either a numeric ID or a name. An all-digit reference (given as a JSON number or a numeric string) is an ID; anything else is a name resolved via the Admin API. The nil *Ref means "not set".