Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ClientIDEnvVar is the environment variable key that represents the registered // Client ID for this web app. ClientIDEnvVar = "CONSOLE_CLIENT_ID" // ClientSecretEnvVar is the environment variable key that represents the // Client Secret associated with the registered Client ID for this web app. ClientSecretEnvVar = "CONSOLE_CLIENT_SECRET" // HostnameEnvVar is the environment variable key that represents the hostname // of this web app. HostnameEnvVar = "CONSOLE_HOSTNAME" // LoginURLEnvVar is the environment variable key that represents the // base login URL endpoint that this app should use to authenticate users. LoginURLEnvVar = "CONSOLE_LOGIN_URL" // UAAURLEnvVar is the environment variable key that represents the // base uaa URL endpoint that this app should use to get tokens. UAAURLEnvVar = "CONSOLE_UAA_URL" // APIURLEnvVar is the environment variable key that represents the // base api URL endpoint that this app should use to access cloud foundry data. APIURLEnvVar = "CONSOLE_API_URL" // LogURLEnvVar is the environment variable key that represents the // endpoint to the loggregator. LogURLEnvVar = "CONSOLE_LOG_URL" // PProfEnabledEnvVar is the environment variable key that represents if the pprof routes // should be enabled. If no value is specified, it is assumed to be false. PProfEnabledEnvVar = "PPROF_ENABLED" // BuildInfoEnvVar is the environment variable key that represents the particular build number BuildInfoEnvVar = "BUILD_INFO" // NewRelicLicenseEnvVar is the New Relic License key so it can collect data. NewRelicLicenseEnvVar = "CONSOLE_NEW_RELIC_LICENSE" // SecureCookiesEnvVar is set to true or 1, then set the Secure flag be set on session coookies SecureCookiesEnvVar = "SECURE_COOKIES" // SessionBackendEnvVar is the session backend type SessionBackendEnvVar = "SESSION_BACKEND" // SessionKeyEnvVar is the secret key used to protect session data SessionKeyEnvVar = "SESSION_KEY" // BasePathEnvVar is the path to the application root BasePathEnvVar = "BASE_PATH" )
var TimeoutConstant = time.Second * 20
TimeoutConstant is a constant which holds how long any incoming request should wait until we timeout. This is useful as some calls from the Go backend to the external API may take a long time. If the user decides to refresh or if the client is polling, multiple requests might build up. This timecaps them.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. Borrowed from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. Borrowed from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/
Types ¶
type EnvVars ¶
type EnvVars struct {
ClientID string
ClientSecret string
Hostname string
LoginURL string
UAAURL string
APIURL string
LogURL string
PProfEnabled string
BuildInfo string
NewRelicLicense string
SecureCookies string
SessionBackend string
SessionKey string
BasePath string
}
EnvVars holds all the environment variable values that a non-test server should have.
type Settings ¶
type Settings struct {
// OAuthConfig is the OAuth client with all the paramters to talk with CF's UAA OAuth Provider.
OAuthConfig *oauth2.Config
// Console API
ConsoleAPI string
// Login URL - used to redirect users to the logout page
LoginURL string
// Sessions is the session store for all connected users.
Sessions sessions.Store
// context.Context var from golang.org/x/net/context to make token Client work
TokenContext context.Context
// Generate secure random state
StateGenerator func() (string, error)
// UAA API
UaaURL string
// Log API
LogURL string
// High Privileged OauthConfig
HighPrivilegedOauthConfig *clientcredentials.Config
// A flag to indicate whether profiling should be included (debug purposes).
PProfEnabled bool
// Build Info
BuildInfo string
//Set the secure flag on session cookies?
SecureCookies bool
}
Settings is the object to hold global values and objects for the service.