Documentation
¶
Overview ¶
Package configuration is in charge of the validation and extraction of all the configuration details from a configuration file.
Index ¶
- Constants
- type Registry
- func (c *Registry) GetAuthDevModeURL() string
- func (c *Registry) GetAuthDomainPrefix() string
- func (c *Registry) GetAuthNotApprovedRedirect() string
- func (c *Registry) GetAuthServiceURL() string
- func (c *Registry) GetAuthShortServiceHostName() string
- func (c *Registry) GetCacheControlArea() string
- func (c *Registry) GetCacheControlAreas() string
- func (c *Registry) GetCacheControlCollaborators() string
- func (c *Registry) GetCacheControlComment() string
- func (c *Registry) GetCacheControlComments() string
- func (c *Registry) GetCacheControlFilters() string
- func (c *Registry) GetCacheControlIteration() string
- func (c *Registry) GetCacheControlIterations() string
- func (c *Registry) GetCacheControlLabel() string
- func (c *Registry) GetCacheControlLabels() string
- func (c *Registry) GetCacheControlQueries() string
- func (c *Registry) GetCacheControlQuery() string
- func (c *Registry) GetCacheControlSpace() string
- func (c *Registry) GetCacheControlSpaceTemplates() string
- func (c *Registry) GetCacheControlSpaces() string
- func (c *Registry) GetCacheControlUser() string
- func (c *Registry) GetCacheControlUsers() string
- func (c *Registry) GetCacheControlWorkItem() string
- func (c *Registry) GetCacheControlWorkItemLink() string
- func (c *Registry) GetCacheControlWorkItemLinkType() string
- func (c *Registry) GetCacheControlWorkItemLinkTypes() string
- func (c *Registry) GetCacheControlWorkItemLinks() string
- func (c *Registry) GetCacheControlWorkItemType() string
- func (c *Registry) GetCacheControlWorkItemTypes() string
- func (c *Registry) GetCacheControlWorkItems() string
- func (c *Registry) GetCheStarterURL() string
- func (c *Registry) GetDefaultConfigurationFile() string
- func (c *Registry) GetDeploymentsHTTPTimeoutSeconds() time.Duration
- func (c *Registry) GetDiagnoseHTTPAddress() string
- func (c *Registry) GetEnvironment() string
- func (c *Registry) GetFeatureWorkitemRemote() bool
- func (c *Registry) GetGithubAuthToken() string
- func (c *Registry) GetHTTPAddress() string
- func (c *Registry) GetHeaderMaxLength() int64
- func (c *Registry) GetKeycloakAccountEndpoint(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakClientID() string
- func (c *Registry) GetKeycloakDevModeURL() string
- func (c *Registry) GetKeycloakDomainPrefix() string
- func (c *Registry) GetKeycloakEndpointAdmin(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointAuth(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointAuthzResourceset(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointBroker(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointClients(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointEntitlement(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointLogout(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointToken(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakEndpointUserInfo(req *http.Request) (string, error)
- func (c *Registry) GetKeycloakRealm() string
- func (c *Registry) GetKeycloakSecret() string
- func (c *Registry) GetKeycloakTestUser2Name() string
- func (c *Registry) GetKeycloakTestUserName() string
- func (c *Registry) GetKeysEndpoint() string
- func (c *Registry) GetLogLevel() string
- func (c *Registry) GetMetricsHTTPAddress() string
- func (c *Registry) GetNotificationServiceURL() string
- func (c *Registry) GetOpenshiftProxyURL() string
- func (c *Registry) GetOpenshiftTenantMasterURL() string
- func (c *Registry) GetPopulateCommonTypes() bool
- func (c *Registry) GetPostgresConfigString() string
- func (c *Registry) GetPostgresConnectionMaxIdle() int
- func (c *Registry) GetPostgresConnectionMaxOpen() int
- func (c *Registry) GetPostgresConnectionRetrySleep() time.Duration
- func (c *Registry) GetPostgresConnectionTimeout() int64
- func (c *Registry) GetPostgresDatabase() string
- func (c *Registry) GetPostgresHost() string
- func (c *Registry) GetPostgresPassword() string
- func (c *Registry) GetPostgresPort() int64
- func (c *Registry) GetPostgresSSLMode() string
- func (c *Registry) GetPostgresTransactionTimeout() time.Duration
- func (c *Registry) GetPostgresUser() string
- func (c *Registry) GetTenantServiceURL() string
- func (c *Registry) GetTogglesServiceURL() string
- func (c *Registry) GetValidRedirectURLs(req *http.Request) (string, error)
- func (c *Registry) IsAuthorizationEnabled() bool
- func (c *Registry) IsLogJSON() bool
- func (c *Registry) IsPostgresDeveloperModeEnabled() bool
- func (c *Registry) String() string
Constants ¶
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 ¶
Get is a wrapper over New() which reads configuration file path from the environment variable.
func (*Registry) GetAuthDevModeURL ¶
GetAuthDevModeURL returns Auth Service URL used by default in Dev mode
func (*Registry) GetAuthDomainPrefix ¶
GetAuthDomainPrefix returns the domain prefix which should be used in requests to the auth service
func (*Registry) GetAuthNotApprovedRedirect ¶
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 ¶
GetAuthServiceURL returns the Auth Service URL
func (*Registry) GetAuthShortServiceHostName ¶
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 ¶
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 ¶
GetCacheControlAreas returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.
func (*Registry) GetCacheControlCollaborators ¶
GetCacheControlCollaborators returns the value to set in the "Cache-Control" HTTP response header when returning collaborators.
func (*Registry) GetCacheControlComment ¶
GetCacheControlComment returns the value to set in the "Cache-Control" HTTP response header when returning a comment.
func (*Registry) GetCacheControlComments ¶
GetCacheControlComments returns the value to set in the "Cache-Control" HTTP response header when returning a list of comments.
func (*Registry) GetCacheControlFilters ¶
GetCacheControlFilters returns the value to set in the "Cache-Control" HTTP response header when returning comments.
func (*Registry) GetCacheControlIteration ¶
GetCacheControlIteration returns the value to set in the "Cache-Control" HTTP response header when returning an iteration.
func (*Registry) GetCacheControlIterations ¶
GetCacheControlIterations returns the value to set in the "Cache-Control" HTTP response header when returning a list of iterations.
func (*Registry) GetCacheControlLabel ¶
GetCacheControlLabel returns the value to set in the "Cache-Control" HTTP response header when returning a label.
func (*Registry) GetCacheControlLabels ¶
GetCacheControlLabels returns the value to set in the "Cache-Control" HTTP response header when returning a list of labels.
func (*Registry) GetCacheControlQueries ¶
GetCacheControlQueries returns the value to set in the "Cache-Control" HTTP response header when returning a list of queries.
func (*Registry) GetCacheControlQuery ¶
GetCacheControlQuery returns the value to set in the "Cache-Control" HTTP response header when returning an query.
func (*Registry) GetCacheControlSpace ¶
GetCacheControlSpace returns the value to set in the "Cache-Control" HTTP response header when returning a space.
func (*Registry) GetCacheControlSpaceTemplates ¶
GetCacheControlSpaceTemplates returns the value to set in the "Cache-Control" HTTP response header when returning space templates.
func (*Registry) GetCacheControlSpaces ¶
GetCacheControlSpaces returns the value to set in the "Cache-Control" HTTP response header when returning a list of spaces.
func (*Registry) GetCacheControlUser ¶
GetCacheControlUser returns the value to set in the "Cache-Control" HTTP response header when data for the current user.
func (*Registry) GetCacheControlUsers ¶
GetCacheControlUsers returns the value to set in the "Cache-Control" HTTP response header when returning users.
func (*Registry) GetCacheControlWorkItem ¶
GetCacheControlWorkItem returns the value to set in the "Cache-Control" HTTP response header when returning a work item.
func (*Registry) GetCacheControlWorkItemLink ¶
GetCacheControlWorkItemLink returns the value to set in the "Cache-Control" HTTP response header when returning a work item.
func (*Registry) GetCacheControlWorkItemLinkType ¶
GetCacheControlWorkItemLinkType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.
func (*Registry) GetCacheControlWorkItemLinkTypes ¶
GetCacheControlWorkItemLinkTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.
func (*Registry) GetCacheControlWorkItemLinks ¶
GetCacheControlWorkItemLinks returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item links.
func (*Registry) GetCacheControlWorkItemType ¶
GetCacheControlWorkItemType returns the value to set in the "Cache-Control" HTTP response header when returning a work item type.
func (*Registry) GetCacheControlWorkItemTypes ¶
GetCacheControlWorkItemTypes returns the value to set in the "Cache-Control" HTTP response header when returning a list of work item types.
func (*Registry) GetCacheControlWorkItems ¶
GetCacheControlWorkItems returns the value to set in the "Cache-Control" HTTP response header when returning a list of work items.
func (*Registry) GetCheStarterURL ¶
GetCheStarterURL returns the URL for the Che Starter service used by codespaces to initiate code editing
func (*Registry) GetDefaultConfigurationFile ¶
GetDefaultConfigurationFile returns the default configuration file.
func (*Registry) GetDeploymentsHTTPTimeoutSeconds ¶
GetDeploymentsTimeout returns the amount of seconds until it should timeout.
func (*Registry) GetDiagnoseHTTPAddress ¶
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 ¶
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 ¶
GetFeatureWorkitemRemote returns true if remote Work Item feaute is enabled
func (*Registry) GetGithubAuthToken ¶
GetGithubAuthToken returns the actual Github OAuth Access Token
func (*Registry) GetHTTPAddress ¶
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 ¶
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 ¶
GetKeycloakAccountEndpoint returns the API URL for Read and Update on Keycloak User Accounts.
func (*Registry) GetKeycloakClientID ¶
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 ¶
GetKeycloakDevModeURL returns Keycloak URL (including realm name) used by default in Dev mode Returns "" if DevMode is not enabled
func (*Registry) GetKeycloakDomainPrefix ¶
GetKeycloakDomainPrefix returns the domain prefix which should be used in all Keycloak requests
func (*Registry) GetKeycloakEndpointAdmin ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
GetKeycloakRealm returns the keycloak realm name
func (*Registry) GetKeycloakSecret ¶
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 ¶
GetKeycloakTestUser2Name returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)
func (*Registry) GetKeycloakTestUserName ¶
GetKeycloakTestUserName returns the keycloak test user name used to obtain a test token (as set via config file or environment variable)
func (*Registry) GetKeysEndpoint ¶
GetKeysEndpoint returns the endpoint to the auth service for key mgmt.
func (*Registry) GetLogLevel ¶
GetLogLevel returns the loggging level (as set via config file or environment variable)
func (*Registry) GetMetricsHTTPAddress ¶
GetMetricsHTTPAddress returns the address the /metrics endpoing will be mounted. By default GetMetricsHTTPAddress is the same as GetHTTPAddress
func (*Registry) GetNotificationServiceURL ¶
GetNotificationServiceURL returns the URL for the Notification service used for event notification
func (*Registry) GetOpenshiftProxyURL ¶
GetOpenshiftProxyURL returns the Openshift Proxy URL, or "" if no URL
func (*Registry) GetOpenshiftTenantMasterURL ¶
GetOpenshiftTenantMasterURL returns the URL for the openshift cluster where the tenant services are running
func (*Registry) GetPopulateCommonTypes ¶
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 ¶
GetPostgresConfigString returns a ready to use string for usage in sql.Open()
func (*Registry) GetPostgresConnectionMaxIdle ¶
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 ¶
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 ¶
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 ¶
GetPostgresConnectionTimeout returns the postgres connection timeout as set via default, config file, or environment variable
func (*Registry) GetPostgresDatabase ¶
GetPostgresDatabase returns the postgres database as set via default, config file, or environment variable
func (*Registry) GetPostgresHost ¶
GetPostgresHost returns the postgres host as set via default, config file, or environment variable
func (*Registry) GetPostgresPassword ¶
GetPostgresPassword returns the postgres password as set via default, config file, or environment variable
func (*Registry) GetPostgresPort ¶
GetPostgresPort returns the postgres port as set via default, config file, or environment variable
func (*Registry) GetPostgresSSLMode ¶
GetPostgresSSLMode returns the postgres sslmode as set via default, config file, or environment variable
func (*Registry) GetPostgresTransactionTimeout ¶
GetPostgresTransactionTimeout returns the number of minutes to timeout a transaction
func (*Registry) GetPostgresUser ¶
GetPostgresUser returns the postgres user as set via default, config file, or environment variable
func (*Registry) GetTenantServiceURL ¶
GetTenantServiceURL returns the URL for the Tenant service used by login to initialize OSO tenant space
func (*Registry) GetTogglesServiceURL ¶
GetTogglesServiceURL returns the URL for the Feature Toggles service used enabling/disabling features per user
func (*Registry) GetValidRedirectURLs ¶
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 ¶
IsAuthorizationEnabled returns true if space authorization enabled
func (*Registry) IsLogJSON ¶
IsLogJSON returns if we should log json format (as set via config file or environment variable)
func (*Registry) IsPostgresDeveloperModeEnabled ¶
IsPostgresDeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable), e.g. token generation endpoint are enabled