Documentation ¶
Index ¶
- func ConfigDir() (string, error)
- func DefaultConfigPath() (string, error)
- func DeleteAccessToken() error
- func LocalDir() (string, error)
- func ProjectConfigFile() string
- func ProjectConfigPath() (string, error)
- func RootGitRepoDir() (string, error)
- func WriteAccessToken(accessToken string) error
- type Config
- type ConfigFS
- type FileConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
DefaultConfigPath returns the default path for the config file.
func DeleteAccessToken ¶ added in v0.125.0
func DeleteAccessToken() error
func ProjectConfigFile ¶ added in v0.9.0
func ProjectConfigFile() string
func ProjectConfigPath ¶ added in v0.2.0
ProjectConfigPath returns the path of a configuration inside a Git repository.
func RootGitRepoDir ¶ added in v0.9.0
func WriteAccessToken ¶ added in v0.125.0
Types ¶
type Config ¶
type Config struct { AccessToken string BaseURL string Organization string ServiceTokenID string ServiceToken string // Project Configuration Database string Branch string }
Config is dynamically sourced from various files and environment variables.
func (*Config) IsAuthenticated ¶
func (*Config) NewClientFromConfig ¶
NewClientFromConfig creates a PlanetScale API client from our configuration
func (*Config) ServiceTokenIsSet ¶ added in v0.163.0
type ConfigFS ¶ added in v0.19.0
type ConfigFS struct {
// contains filtered or unexported fields
}
func NewConfigFS ¶ added in v0.19.0
func (*ConfigFS) DefaultConfig ¶ added in v0.19.0
func (c *ConfigFS) DefaultConfig() (*FileConfig, error)
DefaultConfig returns the file config from the default config path.
func (*ConfigFS) NewFileConfig ¶ added in v0.19.0
func (c *ConfigFS) NewFileConfig(path string) (*FileConfig, error)
NewFileConfig reads the file config from the designated path and returns a new FileConfig.
func (*ConfigFS) ProjectConfig ¶ added in v0.19.0
func (c *ConfigFS) ProjectConfig() (*FileConfig, error)
ProjectConfig returns the file config from the git project
type FileConfig ¶ added in v0.9.0
type FileConfig struct { Organization string `yaml:"org" json:"org"` Database string `yaml:"database,omitempty" json:"database,omitempty"` Branch string `yaml:"branch,omitempty" json:"branch,omitempty"` }
FileConfig defines a pscale configuration from a file.
func (*FileConfig) Write ¶ added in v0.9.0
func (f *FileConfig) Write(path string) error
Write persists the file config at the designated path.
func (*FileConfig) WriteDefault ¶ added in v0.9.0
func (f *FileConfig) WriteDefault() error
WriteDefault creates the config directory and persists the file config to the default global path.
func (*FileConfig) WriteProject ¶ added in v0.9.0
func (f *FileConfig) WriteProject() error
WriteProject persists the file config at the default path which is pulled from the root of the git repository if a user is in one.