Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultGithubClient(username string) github.Client
- func Parse(filename string, obj interface{}) error
- func SetDefaultGithubClient(client github.Client, username string)
- type AddressMap
- type AuthConfig
- type CertConfig
- type ClientConfig
- type Clients
- type OAuthConfig
- type Service
- type ServiceAddress
- type ServiceConfig
- type UserConfig
- type Websockets
Constants ¶
const SessionErrorsKey = "errors"
SessionErrorsKey is the key used to retrieve the errors from the sessions table.
const SessionKey = "tinyci"
SessionKey is the name of the cookie where the session will be stored.
Variables ¶
var DefaultEndpoint = ghoauth.Endpoint
DefaultEndpoint is the default endpoint for oauth2 operations.
var DefaultServices = AddressMap{ Hook: ServiceAddress{Port: 2020}, Data: ServiceAddress{Port: 6000}, Queue: ServiceAddress{Port: 6001}, Asset: ServiceAddress{Port: 6002}, Repository: ServiceAddress{Port: 6003}, Auth: ServiceAddress{Port: 6004}, Log: ServiceAddress{Port: 6005}, UI: ServiceAddress{Port: 6010, HTTP: true}, }
DefaultServices is the standard array of service mappings when unconfigured.
var OAuthRepositoryScope = []string{"repo"}
OAuthRepositoryScope determines how to get enough information out of github to manipulate repositories. The default is to not ask for any real permissions; but for this behavior we need more than that.
var TestClientConfig = ClientConfig{ Data: DefaultServices.Data.String(), Queue: DefaultServices.Queue.String(), UI: DefaultServices.UI.String(), Asset: DefaultServices.Asset.String(), Repository: DefaultServices.Repository.String(), Log: DefaultServices.Log.String(), Auth: DefaultServices.Auth.String(), }
TestClientConfig is a default test client configuration
Functions ¶
func DefaultGithubClient ¶
DefaultGithubClient returns the default github client set by SetDefaultGithubClient, if any.
func SetDefaultGithubClient ¶
SetDefaultGithubClient sets the default github client which is necessary for many testing scenarios. Not to be used in typical code.
Types ¶
type AddressMap ¶
type AddressMap struct { Hook ServiceAddress Data ServiceAddress Queue ServiceAddress UI ServiceAddress Asset ServiceAddress Repository ServiceAddress Auth ServiceAddress Log ServiceAddress }
AddressMap is a mapping of service -> service address
type AuthConfig ¶
type AuthConfig struct { SessionCryptKey string `yaml:"session_crypt_key"` TokenCryptKey string `yaml:"token_crypt_key"` FixedCapabilities map[string][]string `yaml:"fixed_capabilities"` // contains filtered or unexported fields }
AuthConfig is the configuration for auth and secrets in the case auth isn't used.
func (*AuthConfig) ParseTokenKey ¶
func (ac *AuthConfig) ParseTokenKey() error
ParseTokenKey reads the key from the config, validates it, and assigns it to the appropriate variables
func (*AuthConfig) ParsedSessionCryptKey ¶
func (ac *AuthConfig) ParsedSessionCryptKey() []byte
ParsedSessionCryptKey returns the parsed session crypt key
func (*AuthConfig) Validate ¶
func (ac *AuthConfig) Validate(parseCrypt bool) error
Validate ensures the auth configuration is sane.
type CertConfig ¶
type CertConfig struct { CAFile string `yaml:"ca"` CertFile string `yaml:"cert"` KeyFile string `yaml:"key"` }
CertConfig manages the configuration of client and server certs for handler services.
func (CertConfig) Load ¶
func (cc CertConfig) Load() (*transport.Cert, error)
Load loads the cert based on the provided config and returns it.
func (*CertConfig) Validate ¶
func (cc *CertConfig) Validate() error
Validate the certificate configuration (if supplied)
type ClientConfig ¶
type ClientConfig struct { Data string `yaml:"datasvc"` UI string `yaml:"uisvc"` Queue string `yaml:"queuesvc"` Asset string `yaml:"assetsvc"` Log string `yaml:"logsvc"` Repository string `yaml:"reposvc"` Auth string `yaml:"authsvc"` Cert CertConfig `yaml:"tls"` }
ClientConfig configures the clients
func (*ClientConfig) CreateClients ¶
func (cc *ClientConfig) CreateClients(uc UserConfig, service string) (*Clients, error)
CreateClients creates all the clients that are populated in the clients struct. It will also tweak any settings for the github client.
func (*ClientConfig) Validate ¶
func (cc *ClientConfig) Validate() error
Validate validates the client configuration to ensure basic needs are met.
type Clients ¶
type Clients struct { Data *data.Client Queue *queue.Client Asset *asset.Client Log *log.SubLogger Auth *auth.Client }
Clients is a struct that encapsulates the various internal clients we use.
type OAuthConfig ¶
type OAuthConfig struct { ClientID string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` RedirectURL string `yaml:"redirect_url"` }
OAuthConfig configures the oauth end of the uiservice handler, specifically focusing around the application credentials and login process.
func (OAuthConfig) Config ¶
func (oc OAuthConfig) Config(scopes []string) *oauth2.Config
Config returns the oauth configuration if one was provided.
func (OAuthConfig) GithubClient ¶
func (oc OAuthConfig) GithubClient(token *types.OAuthToken) github.Client
GithubClient either returns the client for the token.
func (OAuthConfig) Validate ¶
func (oc OAuthConfig) Validate() error
Validate validates the oauth configuration
type Service ¶
type Service struct { UseSessions bool `yaml:"-"` UseDB bool `yaml:"-"` NoTLSServer bool `yaml:"-"` Formats strfmt.Registry `yaml:"-"` Clients *Clients `yaml:"-"` Model *model.Model `yaml:"-"` Name string `yaml:"-"` }
Service is the internal configuration for a service
type ServiceAddress ¶
ServiceAddress is a well-formed address for service connections
func (ServiceAddress) String ¶
func (sa ServiceAddress) String() string
type ServiceConfig ¶
type ServiceConfig map[string]interface{}
ServiceConfig is the pre-normalized version of the config struct
type UserConfig ¶
type UserConfig struct { ServiceConfig ServiceConfig `yaml:"services"` ClientConfig ClientConfig `yaml:"clients"` OAuth OAuthConfig `yaml:"oauth"` Auth AuthConfig `yaml:"auth"` HookURL string `yaml:"hook_url"` DSN string `yaml:"db"` TLS CertConfig `yaml:"tls"` Websockets Websockets `yaml:"websockets"` RequestLogging bool `yaml:"log_requests"` Port uint `yaml:"port"` URL string `yaml:"url"` EnableTracing bool `yaml:"enable_tracing"` ReadonlyClient bool `yaml:"readonly_client"` }
UserConfig is the user-supplied configuration parsed from yaml.
type Websockets ¶
type Websockets struct { MaxAttachBuffer int64 `yaml:"attach_buffer_size"` BufSize int `yaml:"read_buffer_size"` InsecureWebSockets bool `yaml:"insecure_websockets"` }
Websockets is general websocket configuration.