Documentation ¶
Index ¶
- Constants
- func EnsureValueFilled(value interface{}, path string) error
- func GlobalConfigFileAbsolutePath() (string, error)
- func LocalConfigDirectoryAbsolutePath() (string, error)
- func LocalConfigFileAbsolutePath() (string, error)
- func Marshal(v interface{}) ([]byte, error)
- func Unmarshal(in []byte, v interface{}) error
- func WriteGlobalConfig(config *GlobalConfig) error
- func WriteLocalConfig(config *LocalConfig) error
- type ConfigRecord
- type ConfigurationsSection
- type ErrConfigRecordNotFound
- type ErrKeyInvalid
- type ErrKeyNotSet
- type GlobalConfig
- type LocalConfig
Constants ¶
const ( // LocalConfigDirname is the directory relative to the repository root // that is being used to store all SalsaFlow-related files. LocalConfigDirname = ".salsaflow" // LocalConfigFilename is the filename of the configuration file // that represents local project-specific SalsaFlow configuration. // // This file is expected to be placed in the repository root. LocalConfigFilename = "config.json" )
const ( // GlobalConfigFilename is the filename of the configuration file // that represents global user-specific SalsaFlow configuration. // // This file is expected to be placed in the user's home directory, // although the location can be configured by a command line flag. GlobalConfigFilename = ".salsaflow.json" )
Variables ¶
This section is empty.
Functions ¶
func EnsureValueFilled ¶ added in v0.16.0
EnsureValueFilled returns an error in case the value passed in is not set.
The function checks structs and slices recursively.
func LocalConfigDirectoryAbsolutePath ¶
LocalConfigFileAbsolutePath returns the absolute path of the local configuration directory.
func LocalConfigFileAbsolutePath ¶ added in v0.16.0
LocalConfigFileAbsolutePath returns the absolute path of the local configuration file.
func WriteGlobalConfig ¶ added in v0.16.0
func WriteGlobalConfig(config *GlobalConfig) error
WriteGlobalConfig writes the given configuration struct into the global configuration file.
In case the target path does not exist, it is created, including the parent directories.
In case the file exists, it is truncated.
func WriteLocalConfig ¶ added in v0.16.0
func WriteLocalConfig(config *LocalConfig) error
WriteLocalConfig writes the given configuration struct into the global configuration file.
In case the target path does not exist, it is created, including the parent directories.
In case the file exists, it is truncated.
Types ¶
type ConfigRecord ¶ added in v0.16.0
type ConfigRecord struct { RawConfig []byte // contains filtered or unexported fields }
func (*ConfigRecord) Path ¶ added in v0.16.0
func (ms *ConfigRecord) Path() string
type ConfigurationsSection ¶ added in v0.16.0
type ConfigurationsSection struct {
Records map[string]*json.RawMessage `json:"configuration"`
}
func (*ConfigurationsSection) ConfigRecord ¶ added in v0.16.0
func (section *ConfigurationsSection) ConfigRecord(configKey string) (*ConfigRecord, error)
func (*ConfigurationsSection) SetConfigRecord ¶ added in v0.16.0
func (section *ConfigurationsSection) SetConfigRecord(configKey string, rawConfig []byte)
type ErrConfigRecordNotFound ¶ added in v0.16.0
type ErrConfigRecordNotFound struct {
// contains filtered or unexported fields
}
ErrConfigRecordNotFound is returned from ConfigurationsSection.ConfigRecord when the section specified by the given module kind cannot be found.
func (*ErrConfigRecordNotFound) Error ¶ added in v0.16.0
func (err *ErrConfigRecordNotFound) Error() string
type ErrKeyInvalid ¶
type ErrKeyInvalid struct { Key string Value interface{} }
ErrKeyInvalid can be returned when a configuration value is not valid.
func (*ErrKeyInvalid) Error ¶
func (err *ErrKeyInvalid) Error() string
type ErrKeyNotSet ¶
type ErrKeyNotSet struct {
Key string
}
ErrKeyNotSet is returned when a configuration key is not set.
func (*ErrKeyNotSet) Error ¶
func (err *ErrKeyNotSet) Error() string
type GlobalConfig ¶ added in v0.16.0
type GlobalConfig struct {
*ConfigurationsSection
}
func NewEmptyGlobalConfig ¶ added in v0.16.0
func NewEmptyGlobalConfig() *GlobalConfig
func ReadGlobalConfig ¶ added in v0.16.0
func ReadGlobalConfig() (*GlobalConfig, error)
ReadGlobalConfig reads and parses the global configuration file and returns a struct representing the content.
func (*GlobalConfig) SaveChanges ¶ added in v0.16.0
func (global *GlobalConfig) SaveChanges() error
type LocalConfig ¶ added in v0.16.0
type LocalConfig struct { EnabledTimestamp *time.Time `json:"salsaflow_enabled_timestamp"` Modules struct { IssueTracking string `json:"issue_tracking"` CodeReview string `json:"code_review"` ReleaseNotes string `json:"release_notes"` } `json:"active_modules,omitempty"` *ConfigurationsSection }
LocalConfig represents the local configuration file content.
func NewEmptyLocalConfig ¶ added in v0.16.0
func NewEmptyLocalConfig() *LocalConfig
func ReadLocalConfig ¶ added in v0.16.0
func ReadLocalConfig() (*LocalConfig, error)
ReadLocalConfig reads and parses the global configuration file and returns a struct representing the content.
func (*LocalConfig) SaveChanges ¶ added in v0.16.0
func (local *LocalConfig) SaveChanges() error