configuration

package
v0.0.0-...-ef83997 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file.

Index

Constants

View Source
const (

	// DefaultValidRedirectURLs is a regex to be used to whitelist redirect URL for auth
	// If the F8_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - *
	// In prod mode the following regex will be used by default:
	DefaultValidRedirectURLs = "^(https|http)://([^/]+[.])?(?i:openshift[.]io)(/.*)?$" // *.openshift.io/*

	// DevModeRsaPrivateKey for signing JWT Tokens in Dev Mode
	// ssh-keygen -f alm_rsa
	DevModeRsaPrivateKey = `` /* 1678-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry encapsulates the Viper configuration registry which stores the configuration data in-memory.

func Get

func Get() (*Registry, error)

Get is a wrapper over New() which reads configuration file path from the environment variable.

func New

func New(configFilePath string) (*Registry, error)

New creates a configuration reader object using a configurable configuration file path.

func (*Registry) GetAuthDevModeURL

func (c *Registry) GetAuthDevModeURL() string

GetAuthDevModeURL returns Auth Service URL used by default in Dev mode

func (*Registry) GetAuthDomainPrefix

func (c *Registry) GetAuthDomainPrefix() string

GetAuthDomainPrefix returns the domain prefix which should be used in requests to the auth service

func (*Registry) GetAuthNotApprovedRedirect

func (c *Registry) GetAuthNotApprovedRedirect() string

GetAuthNotApprovedRedirect returns the URL to redirect to if the user is not approved May return empty string which means an unauthorized error should be returned instead of redirecting the user

func (*Registry) GetAuthServiceURL

func (c *Registry) GetAuthServiceURL() string

GetAuthServiceURL returns the Auth Service URL

func (*Registry) GetAuthShortServiceHostName

func (c *Registry) GetAuthShortServiceHostName() string

GetAuthShortServiceHostName returns the short Auth service host name or the full Auth service URL if not set and Dev Mode enabled. Otherwise returns the default host - http://auth

func (*Registry) GetCacheControlArea

func (c *Registry) GetCacheControlArea() string

GetCacheControlArea returns the value to set in the "Cache-Control" HTTP response header when returning a work item (or a list of).

func (*Registry) GetCacheControlAreas

func (c *Registry) GetCacheControlAreas() string

GetCacheControlAreas returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.

func (*Registry) GetCacheControlCollaborators

func (c *Registry) GetCacheControlCollaborators() string

GetCacheControlCollaborators returns the value to set in the "Cache-Control" HTTP response header when returning collaborators.

func (*Registry) GetCacheControlComment

func (c *Registry) GetCacheControlComment() string

GetCacheControlComment returns the value to set in the "Cache-Control" HTTP response header when returning a comment.

func (*Registry) GetCacheControlComments

func (c *Registry) GetCacheControlComments() string

GetCacheControlComments returns the value to set in the "Cache-Control" HTTP response header when returning a list of comments.

func (*Registry) GetCacheControlFilters

func (c *Registry) GetCacheControlFilters() string

GetCacheControlFilters returns the value to set in the "Cache-Control" HTTP response header when returning comments.

func (*Registry) GetCacheControlIteration

func (c *Registry) GetCacheControlIteration() string

GetCacheControlIteration returns the value to set in the "Cache-Control" HTTP response header when returning an iteration.

func (*Registry) GetCacheControlIterations

func (c *Registry) GetCacheControlIterations() string

GetCacheControlIterations returns the value to set in the "Cache-Control" HTTP response header when returning a list of iterations.

func (*Registry) GetCacheControlLabel

func (c *Registry) GetCacheControlLabel() string

GetCacheControlLabel returns the value to set in the "Cache-Control" HTTP response header when returning a label.

func (*Registry) GetCacheControlLabels

func (c *Registry) GetCacheControlLabels() string

GetCacheControlLabels returns the value to set in the "Cache-Control" HTTP response header when returning a list of labels.

func (*Registry) GetCacheControlQueries

func (c *Registry) GetCacheControlQueries() string

GetCacheControlQueries returns the value to set in the "Cache-Control" HTTP response header when returning a list of queries.

func (*Registry) GetCacheControlQuery

func (c *Registry) GetCacheControlQuery() string

GetCacheControlQuery returns the value to set in the "Cache-Control" HTTP response header when returning an query.

func (*Registry) GetCacheControlSpace

func (c *Registry) GetCacheControlSpace() string

GetCacheControlSpace returns the value to set in the "Cache-Control" HTTP response header when returning a space.

func (*Registry) GetCacheControlSpaceTemplates

func (c *Registry) GetCacheControlSpaceTemplates() string

GetCacheControlSpaceTemplates returns the value to set in the "Cache-Control" HTTP response header when returning space templates.

func (*Registry) GetCacheControlSpaces

func (c *Registry) GetCacheControlSpaces() string

GetCacheControlSpaces returns the value to set in the "Cache-Control" HTTP response header when returning a list of spaces.

func (*Registry) GetCacheControlUser

func (c *Registry) GetCacheControlUser() string

GetCacheControlUser returns the value to set in the "Cache-Control" HTTP response header when data for the current user.

func (*Registry) GetCacheControlUsers

func (c *Registry) GetCacheControlUsers() string

GetCacheControlUsers returns the value to set in the "Cache-Control" HTTP response header when returning users.

func (*Registry) GetCacheControlWorkItem

func (c *Registry) GetCacheControlWorkItem() string

GetCacheControlWorkItem returns the value to set in the "Cache-Control" HTTP response header when returning a work item.

func (c *Registry) GetCacheControlWorkItemLink() string

GetCacheControlWorkItemLink returns the value to set in the "Cache-Control" HTTP response header when returning a work item.

func (*Registry) GetCacheControlWorkItemLinkType

func (c *Registry) GetCacheControlWorkItemLinkType() string

GetCacheControlWorkItemLinkType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.

func (*Registry) GetCacheControlWorkItemLinkTypes

func (c *Registry) GetCacheControlWorkItemLinkTypes() string

GetCacheControlWorkItemLinkTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.

func (c *Registry) GetCacheControlWorkItemLinks() string

GetCacheControlWorkItemLinks returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item links.

func (*Registry) GetCacheControlWorkItemType

func (c *Registry) GetCacheControlWorkItemType() string

GetCacheControlWorkItemType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.

func (*Registry) GetCacheControlWorkItemTypes

func (c *Registry) GetCacheControlWorkItemTypes() string

GetCacheControlWorkItemTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.

func (*Registry) GetCacheControlWorkItems

func (c *Registry) GetCacheControlWorkItems() string

GetCacheControlWorkItems returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.

func (*Registry) GetCheStarterURL

func (c *Registry) GetCheStarterURL() string

GetCheStarterURL returns the URL for the Che Starter service used by codespaces to initiate code editing

func (*Registry) GetDefaultConfigurationFile

func (c *Registry) GetDefaultConfigurationFile() string

GetDefaultConfigurationFile returns the default configuration file.

func (*Registry) GetDeploymentsHTTPTimeoutSeconds

func (c *Registry) GetDeploymentsHTTPTimeoutSeconds() time.Duration

GetDeploymentsTimeout returns the amount of seconds until it should timeout.

func (*Registry) GetDiagnoseHTTPAddress

func (c *Registry) GetDiagnoseHTTPAddress() string

GetDiagnoseHTTPAddress returns the address of where to start the gops handler. By default GetDiagnoseHTTPAddress is 127.0.0.1:0 in devMode, but turned off in prod mode unless explicitly configured

func (*Registry) GetEnvironment

func (c *Registry) GetEnvironment() string

GetEnvironment returns the current environment application is deployed in like 'prod', 'preview', 'local', etc as the value of environment variable `F8_ENVIRONMENT` is set.

func (*Registry) GetFeatureWorkitemRemote

func (c *Registry) GetFeatureWorkitemRemote() bool

GetFeatureWorkitemRemote returns true if remote Work Item feaute is enabled

func (*Registry) GetGithubAuthToken

func (c *Registry) GetGithubAuthToken() string

GetGithubAuthToken returns the actual Github OAuth Access Token

func (*Registry) GetHTTPAddress

func (c *Registry) GetHTTPAddress() string

GetHTTPAddress returns the HTTP address (as set via default, config file, or environment variable) that the wit server binds to (e.g. "0.0.0.0:8080")

func (*Registry) GetHeaderMaxLength

func (c *Registry) GetHeaderMaxLength() int64

GetHeaderMaxLength returns the max length of HTTP headers allowed in the system For example it can be used to limit the size of bearer tokens returned by the api service

func (*Registry) GetKeycloakAccountEndpoint

func (c *Registry) GetKeycloakAccountEndpoint(req *http.Request) (string, error)

GetKeycloakAccountEndpoint returns the API URL for Read and Update on Keycloak User Accounts.

func (*Registry) GetKeycloakClientID

func (c *Registry) GetKeycloakClientID() string

GetKeycloakClientID returns the keycloak client ID (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.

func (*Registry) GetKeycloakDevModeURL

func (c *Registry) GetKeycloakDevModeURL() string

GetKeycloakDevModeURL returns Keycloak URL (including realm name) used by default in Dev mode Returns "" if DevMode is not enabled

func (*Registry) GetKeycloakDomainPrefix

func (c *Registry) GetKeycloakDomainPrefix() string

GetKeycloakDomainPrefix returns the domain prefix which should be used in all Keycloak requests

func (*Registry) GetKeycloakEndpointAdmin

func (c *Registry) GetKeycloakEndpointAdmin(req *http.Request) (string, error)

GetKeycloakEndpointAdmin returns the <keycloak>/realms/admin/<realm> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointAuth

func (c *Registry) GetKeycloakEndpointAuth(req *http.Request) (string, error)

GetKeycloakEndpointAuth returns the keycloak auth endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointAuthzResourceset

func (c *Registry) GetKeycloakEndpointAuthzResourceset(req *http.Request) (string, error)

GetKeycloakEndpointAuthzResourceset returns the <keycloak>/realms/<realm>/authz/protection/resource_set endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointBroker

func (c *Registry) GetKeycloakEndpointBroker(req *http.Request) (string, error)

GetKeycloakEndpointBroker returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointClients

func (c *Registry) GetKeycloakEndpointClients(req *http.Request) (string, error)

GetKeycloakEndpointClients returns the <keycloak>/admin/realms/<realm>/clients endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointEntitlement

func (c *Registry) GetKeycloakEndpointEntitlement(req *http.Request) (string, error)

GetKeycloakEndpointEntitlement returns the <keycloak>/realms/<realm>/authz/entitlement/<clientID> endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointLogout

func (c *Registry) GetKeycloakEndpointLogout(req *http.Request) (string, error)

GetKeycloakEndpointLogout returns the keycloak logout endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointToken

func (c *Registry) GetKeycloakEndpointToken(req *http.Request) (string, error)

GetKeycloakEndpointToken returns the keycloak token endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakEndpointUserInfo

func (c *Registry) GetKeycloakEndpointUserInfo(req *http.Request) (string, error)

GetKeycloakEndpointUserInfo returns the keycloak userinfo endpoint set via config file or environment variable. If nothing set then in Dev environment the defualt endopoint will be returned. In producion the endpoint will be calculated from the request by replacing the last domain/host name in the full host name. Example: api.service.domain.org -> sso.service.domain.org or api.domain.org -> sso.domain.org

func (*Registry) GetKeycloakRealm

func (c *Registry) GetKeycloakRealm() string

GetKeycloakRealm returns the keycloak realm name

func (*Registry) GetKeycloakSecret

func (c *Registry) GetKeycloakSecret() string

GetKeycloakSecret returns the keycloak client secret (as set via config file or environment variable) that is used to make authorized Keycloak API Calls.

func (*Registry) GetKeycloakTestUser2Name

func (c *Registry) GetKeycloakTestUser2Name() string

GetKeycloakTestUser2Name returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)

func (*Registry) GetKeycloakTestUserName

func (c *Registry) GetKeycloakTestUserName() string

GetKeycloakTestUserName returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)

func (*Registry) GetKeysEndpoint

func (c *Registry) GetKeysEndpoint() string

GetKeysEndpoint returns the endpoint to the auth service for key mgmt.

func (*Registry) GetLogLevel

func (c *Registry) GetLogLevel() string

GetLogLevel returns the loggging level (as set via config file or environment variable)

func (*Registry) GetMetricsHTTPAddress

func (c *Registry) GetMetricsHTTPAddress() string

GetMetricsHTTPAddress returns the address the /metrics endpoing will be mounted. By default GetMetricsHTTPAddress is the same as GetHTTPAddress

func (*Registry) GetNotificationServiceURL

func (c *Registry) GetNotificationServiceURL() string

GetNotificationServiceURL returns the URL for the Notification service used for event notification

func (*Registry) GetOpenshiftProxyURL

func (c *Registry) GetOpenshiftProxyURL() string

GetOpenshiftProxyURL returns the Openshift Proxy URL, or "" if no URL

func (*Registry) GetOpenshiftTenantMasterURL

func (c *Registry) GetOpenshiftTenantMasterURL() string

GetOpenshiftTenantMasterURL returns the URL for the openshift cluster where the tenant services are running

func (*Registry) GetPopulateCommonTypes

func (c *Registry) GetPopulateCommonTypes() bool

GetPopulateCommonTypes returns true if the (as set via default, config file, or environment variable) the common work item types such as bug or feature shall be created.

func (*Registry) GetPostgresConfigString

func (c *Registry) GetPostgresConfigString() string

GetPostgresConfigString returns a ready to use string for usage in sql.Open()

func (*Registry) GetPostgresConnectionMaxIdle

func (c *Registry) GetPostgresConnectionMaxIdle() int

GetPostgresConnectionMaxIdle returns the number of connections that should be keept alive in the database connection pool at any given time. -1 represents no restrictions/default behavior

func (*Registry) GetPostgresConnectionMaxOpen

func (c *Registry) GetPostgresConnectionMaxOpen() int

GetPostgresConnectionMaxOpen returns the max number of open connections that should be open in the database connection pool. -1 represents no restrictions/default behavior

func (*Registry) GetPostgresConnectionRetrySleep

func (c *Registry) GetPostgresConnectionRetrySleep() time.Duration

GetPostgresConnectionRetrySleep returns the number of seconds (as set via default, config file, or environment variable) to wait before trying to connect again

func (*Registry) GetPostgresConnectionTimeout

func (c *Registry) GetPostgresConnectionTimeout() int64

GetPostgresConnectionTimeout returns the postgres connection timeout as set via default, config file, or environment variable

func (*Registry) GetPostgresDatabase

func (c *Registry) GetPostgresDatabase() string

GetPostgresDatabase returns the postgres database as set via default, config file, or environment variable

func (*Registry) GetPostgresHost

func (c *Registry) GetPostgresHost() string

GetPostgresHost returns the postgres host as set via default, config file, or environment variable

func (*Registry) GetPostgresPassword

func (c *Registry) GetPostgresPassword() string

GetPostgresPassword returns the postgres password as set via default, config file, or environment variable

func (*Registry) GetPostgresPort

func (c *Registry) GetPostgresPort() int64

GetPostgresPort returns the postgres port as set via default, config file, or environment variable

func (*Registry) GetPostgresSSLMode

func (c *Registry) GetPostgresSSLMode() string

GetPostgresSSLMode returns the postgres sslmode as set via default, config file, or environment variable

func (*Registry) GetPostgresTransactionTimeout

func (c *Registry) GetPostgresTransactionTimeout() time.Duration

GetPostgresTransactionTimeout returns the number of minutes to timeout a transaction

func (*Registry) GetPostgresUser

func (c *Registry) GetPostgresUser() string

GetPostgresUser returns the postgres user as set via default, config file, or environment variable

func (*Registry) GetTenantServiceURL

func (c *Registry) GetTenantServiceURL() string

GetTenantServiceURL returns the URL for the Tenant service used by login to initialize OSO tenant space

func (*Registry) GetTogglesServiceURL

func (c *Registry) GetTogglesServiceURL() string

GetTogglesServiceURL returns the URL for the Feature Toggles service used enabling/disabling features per user

func (*Registry) GetValidRedirectURLs

func (c *Registry) GetValidRedirectURLs(req *http.Request) (string, error)

GetValidRedirectURLs returns the RegEx of valid redirect URLs for auth requests If the F8_REDIRECT_VALID env var is not set then in Dev Mode all redirects allowed - * In prod mode the default regex will be returned

func (*Registry) IsAuthorizationEnabled

func (c *Registry) IsAuthorizationEnabled() bool

IsAuthorizationEnabled returns true if space authorization enabled

func (*Registry) IsLogJSON

func (c *Registry) IsLogJSON() bool

IsLogJSON returns if we should log json format (as set via config file or environment variable)

func (*Registry) IsPostgresDeveloperModeEnabled

func (c *Registry) IsPostgresDeveloperModeEnabled() bool

IsPostgresDeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable), e.g. token generation endpoint are enabled

func (*Registry) String

func (c *Registry) String() string

String returns the current configuration as a string

Jump to

Keyboard shortcuts

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