config

package
v0.0.0-...-afecb3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRepoConfigFlags

func AddRepoConfigFlags(flags *pflag.FlagSet)

AddRepoConfigFlags adds per-repository configuration items to the given flagset

func AddUserConfigFlags

func AddUserConfigFlags(flags *pflag.FlagSet)

AddUserConfigFlags adds per-user configuration item flags to the given flagset

func DefaultUserConfigPath

func DefaultUserConfigPath() titanpath.AbsoluteSystemPath

DefaultUserConfigPath returns the default platform-dependent place that we store the user-specific configuration.

func GetRepoConfigPath

func GetRepoConfigPath(repoRoot titanpath.AbsoluteSystemPath) titanpath.AbsoluteSystemPath

GetRepoConfigPath reads the user-specific configuration values

Types

type RepoConfig

type RepoConfig struct {
	// contains filtered or unexported fields
}

RepoConfig is a configuration object for the logged-in titanrepo.com user

func ReadRepoConfigFile

func ReadRepoConfigFile(path titanpath.AbsoluteSystemPath, flags *pflag.FlagSet) (*RepoConfig, error)

ReadRepoConfigFile creates a RepoConfig using the specified path as the repo config file. Note that the path or its parents do not need to exist. On a write to this configuration, they will be created.

func (*RepoConfig) Delete

func (rc *RepoConfig) Delete() error

Delete deletes the config file. This repo config shouldn't be used afterwards, it needs to be re-initialized

func (*RepoConfig) GetRemoteConfig

func (rc *RepoConfig) GetRemoteConfig(token string) client.RemoteConfig

GetRemoteConfig produces the necessary values for an API client configuration

func (*RepoConfig) LoginURL

func (rc *RepoConfig) LoginURL() string

LoginURL returns the configured URL for authenticating the user

func (*RepoConfig) SetTeamID

func (rc *RepoConfig) SetTeamID(teamID string) error

SetTeamID sets the teamID and clears the slug, since it may have been from an old team

type UserConfig

type UserConfig struct {
	// contains filtered or unexported fields
}

UserConfig is a wrapper around the user-specific configuration values for Titanrepo.

func ReadUserConfigFile

func ReadUserConfigFile(path titanpath.AbsoluteSystemPath, flags *pflag.FlagSet) (*UserConfig, error)

ReadUserConfigFile creates a UserConfig using the specified path as the user config file. Note that the path or its parents do not need to exist. On a write to this configuration, they will be created.

func (*UserConfig) Delete

func (uc *UserConfig) Delete() error

Delete deletes the config file. This user config shouldn't be used afterwards, it needs to be re-initialized

func (*UserConfig) SetToken

func (uc *UserConfig) SetToken(token string) error

SetToken saves a Bearer token for this user, writing it to the user config file, creating it if necessary

func (*UserConfig) Token

func (uc *UserConfig) Token() string

Token returns the Bearer token for this user if it exists

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL