config

package
v0.0.0-...-b69bfab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2014 License: Apache-2.0 Imports: 13 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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

View Source
var HSCAdminGitHubToken string

HSCAdminGitHubToken is GitHub API token belonging to a user on the GitHub owner team.

View Source
var HSCAdminOrg string

HSCAdminOrg is GitHub organization that user is operatate against.

View Source
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

type Config struct {
	Org   string
	User  string
	Dir   string
	Token string
}

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

func LoadConfig() (*Config, error)

LoadConfig attempts to read the configuration file and return a Config

func (*Config) GetToken

func (c *Config) GetToken() string

GetToken returns the value of the user's GitHub Token environment variable or the user-supplied token value -- whichever was provided.

func (*Config) GitHubClient

func (c *Config) GitHubClient() *github.Client

GitHubClient returns a GitHub build with Token.

func (*Config) HTTPClient

func (c *Config) HTTPClient() *http.Client

HTTPClient returns a http client built with Token. This client is suitable for OAuth authentication

func (*Config) Validate

func (c *Config) Validate() error

Validate does some sanity checking of the Config

func (*Config) Write

func (c *Config) Write() error

WriteConfig attempts to write the configuration file to disk

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL