Documentation ¶
Index ¶
- Constants
- func AddConfigFlags(cmd *cobra.Command)
- func GetAndInsertCorso(passphase string) credentials.Corso
- func GetM365(m365Cfg account.M365Config) credentials.M365
- func GetStorageProviderFromConfigFile(ctx context.Context) (storage.ProviderType, error)
- func GetViper(ctx context.Context) *viper.Viper
- func InitCmd(cmd *cobra.Command, args []string) error
- func InitConfig(ctx context.Context, userDefinedConfigFile string) (context.Context, error)
- func Read(ctx context.Context) error
- func Seed(ctx context.Context) context.Context
- func SetViper(ctx context.Context, vpr *viper.Viper) context.Context
- func WriteRepoConfig(ctx context.Context, wcs storage.WriteConfigToStorer, ...) error
- type RepoDetails
Constants ¶
const ( RepoID = "repo_id" // Corso passphrase in config CorsoPassphrase = "passphrase" CorsoUser = "corso_user" CorsoHost = "corso_host" )
Variables ¶
This section is empty.
Functions ¶
func AddConfigFlags ¶
adds the persistent flag --config-file to the provided command.
func GetAndInsertCorso ¶
func GetAndInsertCorso(passphase string) credentials.Corso
GetCorso is a helper for aggregating Corso secrets and credentials.
func GetM365 ¶
func GetM365(m365Cfg account.M365Config) credentials.M365
M365 is a helper for aggregating m365 secrets and credentials.
func GetStorageProviderFromConfigFile ¶
func GetStorageProviderFromConfigFile(ctx context.Context) (storage.ProviderType, error)
GetStorageProviderFromConfigFile reads the storage provider from the config file. Storage provider can only be sourced from config file with the exception of commands that create or connect to a repo.
func GetViper ¶
Gets a viper instance from the context. If no viper instance is found, returns the default (global) viper instance.
func InitCmd ¶
InitCmd provides a func that lazily initializes viper and verifies that the configuration was able to read a file.
func InitConfig ¶
InitConfig allows sdk consumers to initialize viper.
func Read ¶
Read reads the config from the viper instance in the context. Primarily used as a test-check to ensure the instance was set up properly.
func SetViper ¶
Adds a viper instance to the context. If vpr is nil, sets the default (global) viper.
func WriteRepoConfig ¶
func WriteRepoConfig( ctx context.Context, wcs storage.WriteConfigToStorer, m365Config account.M365Config, repoOpts repository.Options, repoID string, ) error
WriteRepoConfig currently just persists corso config to the config file It does not check for conflicts or existing data.
Types ¶
type RepoDetails ¶
type RepoDetails struct { Storage storage.Storage Account account.Account RepoID string RepoUser string RepoHost string }
RepoDetails holds the repository configuration retrieved from the .corso.toml configuration file.
func ReadCorsoConfig ¶
func ReadCorsoConfig( ctx context.Context, provider storage.ProviderType, readFromFile bool, mustMatchFromConfig bool, overrides map[string]string, ) (RepoDetails, error)
ReadCorsoConfig creates a storage and account instance by mediating all the possible data sources (config file, env vars, flag overrides) and the config file.