Documentation
¶
Index ¶
Constants ¶
const ( // ConfigPathEnvVar identifies the environment variable that overrides the default location (i.e. user's home directory) of the HSC configuration file. ConfigPathEnvVar = "HSC_CONFIG_HOME" // GitHubTokenEnvVar identifies the environment variable that contains a user's GitHub API token. GitHubTokenEnvVar = "GITHUB_TOKEN" // ConfigFileName is the name of the HSC configuration file. ConfigFileName = ".hsc" // ErrMissingDir is an error message indicating a Config without a Dir variable ErrMissingDir = "dir is required" // ErrDirDoesNotExist is an error message indicating a Config's Dir variable references a directory that does not exist ErrDirDoesNotExist = "directory does not exist" // ErrMissingUser is an error message indicating a Config without a User variable ErrMissingUser = "a user is required. This should be your GitHub username" // ErrAuthUser is an error message indicating a Config's User cannot be authenticated against GitHub (using Token) ErrAuthUser = "unable to authenticate against GitHub using the oauth token provided" // ErrUserMismatch is an error message indicating a Config's User variable does not match data returned from GitHub ErrUserMismatch = "username provided does not match GitHub login or email associated with your authenicated user" // ErrMissingToken is an error message indicating a Config without a Token variable ErrMissingToken = "a GitHub oauth token is required. Goto https://github.com/blog/1509-personal-api-tokens to learn about tokens" // ErrOrgDoesNotExist is an error message indicating a Config's Org variable references an organization that does not exist on GitHub ErrOrgDoesNotExist = "org does not exist on GitHub" // ErrUserNotOrgMember is an error message indicating a Config's User is not a member of the GitHub organization identified by the Org variable ErrUserNotOrgMember = "" /* 153-byte string literal not displayed */ )
Variables ¶
var HSCAdminGitHubToken string
HSCAdminGitHubToken is GitHub API token belonging to a user on the GitHub owner team.
var HSCAdminOrg string
HSCAdminOrg is GitHub organization that user is operatate against.
var HSCAdminUser string
HSCAdminUser is a user variable required to create a valid config. Not really used.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is the configuration for HSC. The idea is to collect (as configuration) any data attributes that tend to be used across sub-commands.
func LoadConfig ¶
LoadConfig attempts to read the configuration file and return a Config
func (*Config) GetToken ¶
GetToken returns the value of the user's GitHub Token environment variable or the user-supplied token value -- whichever was provided.
func (*Config) GitHubClient ¶
GitHubClient returns a GitHub build with Token.
func (*Config) HTTPClient ¶
HTTPClient returns a http client built with Token. This client is suitable for OAuth authentication