Documentation ¶
Overview ¶
Package config provides methods for fetching and storing configuration.
Index ¶
- Variables
- func ReadGoogleClientConfigFromFile(filepath string) (*oauth2.Config, error)
- type FileProvider
- func (f *FileProvider) GoogleClientConfig() (*oauth2.Config, error)
- func (f *FileProvider) GoogleClientConfigExists() bool
- func (f *FileProvider) GoogleToken() (*oauth2.Token, error)
- func (f *FileProvider) GoogleTokenExists() bool
- func (f *FileProvider) StoreGoogleClientConfig(conf *oauth2.Config) error
- func (f *FileProvider) StoreGoogleToken(token *oauth2.Token) error
- type Provider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoGoogleClientConfig indicates that the client configuration is missing. ErrNoGoogleClientConfig = errors.New("missing google client config") // ErrNoGoogleToken indicatges that the token is missing. ErrNoGoogleToken = errors.New("missing google token") )
Functions ¶
Types ¶
type FileProvider ¶
type FileProvider struct {
// contains filtered or unexported fields
}
FileProvider is a Provider which uses files to store data.
func NewFileProvider ¶
func NewFileProvider() (*FileProvider, error)
NewFileProvider returns a new FileProvider with the default filepath.
func (*FileProvider) GoogleClientConfig ¶
func (f *FileProvider) GoogleClientConfig() (*oauth2.Config, error)
GoogleClientConfig returns the Google client configuration from the configuration file.
func (*FileProvider) GoogleClientConfigExists ¶
func (f *FileProvider) GoogleClientConfigExists() bool
GoogleClientConfigExists returns true if the config is readable and valid, false otherwise.
func (*FileProvider) GoogleToken ¶
func (f *FileProvider) GoogleToken() (*oauth2.Token, error)
GoogleToken fetches the Google token from the configuration file.
func (*FileProvider) GoogleTokenExists ¶
func (f *FileProvider) GoogleTokenExists() bool
GoogleTokenExists returns true if the token is readable and valid, false otherwise.
func (*FileProvider) StoreGoogleClientConfig ¶
func (f *FileProvider) StoreGoogleClientConfig(conf *oauth2.Config) error
StoreGoogleClientConfig writes the Google client config to the configuration file.
func (*FileProvider) StoreGoogleToken ¶
func (f *FileProvider) StoreGoogleToken(token *oauth2.Token) error
StoreGoogleToken writes the Google token to the configuration file.
type Provider ¶
type Provider interface { // GoogleClientConfig returns the Google client config. GoogleClientConfig() (*oauth2.Config, error) // StoreGoogleClientConfig writes the Google client config. StoreGoogleClientConfig(*oauth2.Config) error // GoogleClientConfigExists returns true if the client config is readable, false otherwise. GoogleClientConfigExists() bool // GoogleToken returns the Google token. GoogleToken() (*oauth2.Token, error) // StoreGoogleToken writes the Google token. StoreGoogleToken(*oauth2.Token) error // GoogleTokenExists returns true if the token is readable, false otherwise. GoogleTokenExists() bool }
Provider is a token provider.