Documentation
¶
Overview ¶
Package dotrill implements setting and getting key-value pairs in YAML files in ~/.rill.
Index ¶
- Constants
- type DotRill
- func (d DotRill) AnalyticsInfo() (installID string, enabled bool, err error)
- func (d DotRill) Get(filename, key string) (string, error)
- func (d DotRill) GetAccessToken() (string, error)
- func (d DotRill) GetAll(filename string) (map[string]string, error)
- func (d DotRill) GetBackupToken() (string, error)
- func (d DotRill) GetDefaultAdminURL() (string, error)
- func (d DotRill) GetDefaultOrg() (string, error)
- func (d DotRill) GetEnvToken(env string) (string, error)
- func (d DotRill) GetRepresentingUser() (string, error)
- func (d DotRill) GetUserCheckHash() (string, error)
- func (d DotRill) GetUserID() (string, error)
- func (d DotRill) GetVersion() (string, error)
- func (d DotRill) GetVersionUpdatedAt() (string, error)
- func (d DotRill) ResolveFilename(name string, mkdir bool) (string, error)
- func (d DotRill) Set(filename, key, value string) error
- func (d DotRill) SetAccessToken(token string) error
- func (d DotRill) SetBackupToken(token string) error
- func (d DotRill) SetDefaultAdminURL(url string) error
- func (d DotRill) SetDefaultOrg(orgName string) error
- func (d DotRill) SetEnvToken(env, token string) error
- func (d DotRill) SetRepresentingUser(email string) error
- func (d DotRill) SetUserCheckHash(hash string) error
- func (d DotRill) SetUserID(userID string) error
- func (d DotRill) SetVersion(version string) error
- func (d DotRill) SetVersionUpdatedAt(updatedAt string) error
Constants ¶
const ( ConfigFilename = "config.yaml" // For user-facing config CredentialsFilename = "credentials.yaml" // For access tokens StateFilename = "state.yaml" // For CLI state )
Constants for YAML files
const ( DefaultOrgConfigKey = "org" DefaultAdminURLConfigKey = "api_url" AnalyticsEnabledConfigKey = "analytics_enabled" AccessTokenCredentialsKey = "token" InstallIDStateKey = "install_id" RepresentingUserCredentialsKey = "representing_user" BackupTokenCredentialsKey = "backup_token" LatestVersionStateKey = "latest_version" LatestVersionCheckedAtStateKey = "latest_version_checked_at" UserIDStateKey = "user_id" UserCheckHashStateKey = "user_check_hash" )
Constants for YAML keys
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DotRill ¶ added in v0.60.7
type DotRill struct {
// contains filtered or unexported fields
}
DotRill encapsulates access to .rill.
func New ¶ added in v0.60.7
New creates a new Dotrill instance. If homeDir is empty, it creates `.rill` in the user's home directory.
func (DotRill) AnalyticsInfo ¶ added in v0.60.7
AnalyticsInfo returns analytics info. It loads a persistent install ID from ~/.rill/state.yaml (setting one if not found). It gets analytics enabled/disabled info from ~/.rill/config.yaml (key "analytics_enabled"). It automatically migrates from the pre-v0.23 analytics config. See migrateOldAnalyticsConfig for details.
func (DotRill) Get ¶ added in v0.60.7
Get returns a single entry from ~/.rill/{filename}. It assumes filename identifies a YAML file.
func (DotRill) GetAccessToken ¶ added in v0.60.7
GetToken loads the current auth token
func (DotRill) GetAll ¶ added in v0.60.7
GetAll loads all values from ~/.rill/{filename}. It assumes filename identifies a YAML file.
func (DotRill) GetBackupToken ¶ added in v0.60.7
GetBackupToken loads the original auth token
func (DotRill) GetDefaultAdminURL ¶ added in v0.60.7
GetDefaultAdminURL loads the default admin URL (if set)
func (DotRill) GetDefaultOrg ¶ added in v0.60.7
GetDefaultOrg loads the default org
func (DotRill) GetEnvToken ¶ added in v0.60.7
GetEnvToken loads the token for given env
func (DotRill) GetRepresentingUser ¶ added in v0.60.7
GetRepresentingUser loads the current representing user email
func (DotRill) GetUserCheckHash ¶ added in v0.60.7
GetUserCheckHash gets the hash used to determine whether to re-fetch the user ID.
func (DotRill) GetVersion ¶ added in v0.60.7
func (DotRill) GetVersionUpdatedAt ¶ added in v0.60.7
func (DotRill) ResolveFilename ¶ added in v0.60.7
ResolveFilename resolves a file name to a full path to ~/.rill. If mkdir is true, it will create the .rill directory if it doesn't exist.
func (DotRill) Set ¶ added in v0.60.7
Set sets a single value in ~/.rill/{filename}. It assumes filename identifies a YAML file.
func (DotRill) SetAccessToken ¶ added in v0.60.7
SetToken saves an auth token
func (DotRill) SetBackupToken ¶ added in v0.60.7
SetBackupToken saves original auth token
func (DotRill) SetDefaultAdminURL ¶ added in v0.60.7
SetDefaultAdminURL loads the default admin URL (if set)
func (DotRill) SetDefaultOrg ¶ added in v0.60.7
SetDefaultOrg saves the default org
func (DotRill) SetEnvToken ¶ added in v0.60.7
SetEnvToken backup the token for given env
func (DotRill) SetRepresentingUser ¶ added in v0.60.7
SetRepresentingUser saves representing user email
func (DotRill) SetUserCheckHash ¶ added in v0.60.7
SetUserCheckHash sets the hash used to determine whether to re-fetch the user ID.