Documentation ¶
Index ¶
Constants ¶
const (
TokenFileMode = 0600
)
Variables ¶
This section is empty.
Functions ¶
func AccessTokenPath ¶
AccessTokenPath is the path for the access token file
func DefaultConfigPath ¶
DefaultConfigPath returns the default path for the config file.
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
Types ¶
type Config ¶
type Config struct { AccessToken string BaseURL string Organization string ServiceTokenName 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 PlaentScale API client from our configuration
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 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.