Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

Commit

Permalink
Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeykazakov committed Aug 15, 2018
1 parent 0c3663e commit b48c73d
Show file tree
Hide file tree
Showing 73 changed files with 116 additions and 2,444 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM centos:7
LABEL maintainer "Devtools <devtools@redhat.com>"
LABEL author "Konrad Kleine <kkleine@redhat.com>"
ENV LANG=en_US.utf8
ENV AUTH_INSTALL_PREFIX=/usr/local/cluster
ENV CLUSTER_INSTALL_PREFIX=/usr/local/cluster

# Create a non-root user and a group with the same name: "cluster"
ENV CLUSTER_USER_NAME=cluster
Expand Down
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ $ cd $GOPATH/src/github.com/fabric8-services/fabric8-cluster
$ make test-all
----

By default, test data is removed from the database after each test, unless the `AUTH_CLEAN_TEST_DATA` environment variable is set to `false`. This can be particularily useful to run queries on the test data after a test failure, in order to understand why the result did not match the expectations.
By default, test data is removed from the database after each test, unless the `CLUSTER_CLEAN_TEST_DATA` environment variable is set to `false`. This can be particularily useful to run queries on the test data after a test failure, in order to understand why the result did not match the expectations.

Also, all SQL queries can be displayed in the output if the `AUTH_ENABLE_DB_LOGS` environment variable is set to `true. Beware that this can be very verbose, though ;)
Also, all SQL queries can be displayed in the output if the `CLUSTER_ENABLE_DB_LOGS` environment variable is set to `true. Beware that this can be very verbose, though ;)

===== Coverage [[coverage]]

Expand Down Expand Up @@ -272,7 +272,7 @@ The database are kept in a docker container that gets reused between restarts. T
To clear out the database kill the database like this:

----
$ docker kill fabric8auth_db_1 && docker rm fabric8auth_db_1
$ docker kill fabric8CLUSTER_db_1 && docker rm fabric8CLUSTER_db_1
----

In case you have mulitple `fabric8*` running use `docker ps` to locate the container name.
Expand Down
2 changes: 1 addition & 1 deletion application/repository/base/exister.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/fabric8-services/fabric8-cluster/errors"
"github.com/fabric8-services/fabric8-common/errors"

"github.com/jinzhu/gorm"
errs "github.com/pkg/errors"
Expand Down
40 changes: 30 additions & 10 deletions configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ const (
varPostgresConnectionMaxOpen = "postgres.connection.maxopen"

// Other services URLs
varClusterURL = "cluster.url"
varAuthURL = "cluster.auth.url"
varClusterServiceURL = "cluster.url"
varAuthURL = "cluster.auth.url"
varAuthKeysPath = "cluster.auth.keys.path"

// sentry
varEnvironment = "environment"
Expand Down Expand Up @@ -133,7 +134,7 @@ func NewConfigurationData(mainConfigFile string, osoClusterConfigFile string) (*
c.clusterConfigFilePath = clusterConfigFilePath

// Check sensitive default configuration
if c.IsPostgresDeveloperModeEnabled() {
if c.DeveloperModeEnabled() {
c.appendDefaultConfigErrorMessage("developer Mode is enabled")
}
if c.GetPostgresPassword() == defaultDBPassword {
Expand All @@ -143,6 +144,7 @@ func NewConfigurationData(mainConfigFile string, osoClusterConfigFile string) (*
if c.GetClusterServiceURL() == "http://localhost" {
c.appendDefaultConfigErrorMessage("environment is expected to be set to 'production' or 'prod-preview'")
}
c.validateURL(c.GetAuthServiceURL(), "Auth service")
if c.GetSentryDSN() == "" {
c.appendDefaultConfigErrorMessage("Sentry DSN is empty")
}
Expand Down Expand Up @@ -424,8 +426,8 @@ func (c *ConfigurationData) DefaultConfigurationError() error {

// GetClusterServiceUrl returns Cluster Service URL
func (c *ConfigurationData) GetClusterServiceURL() string {
if c.v.IsSet(varClusterURL) {
return c.v.GetString(varClusterURL)
if c.v.IsSet(varClusterServiceURL) {
return c.v.GetString(varClusterServiceURL)
}
switch c.GetEnvironment() {
case prodEnvironment:
Expand All @@ -437,6 +439,22 @@ func (c *ConfigurationData) GetClusterServiceURL() string {
}
}

// GetAuthServiceUrl returns Auth Service URL
func (c *ConfigurationData) GetAuthServiceURL() string {
if c.v.IsSet(varAuthURL) {
return c.v.GetString(varAuthURL)
}
if c.DeveloperModeEnabled() {
return "https://auth.prod-preview.openshift.io"
}
return ""
}

// GetAuthKeysPath returns the path to auth keys endpoint
func (c *ConfigurationData) GetAuthKeysPath() string {
return c.v.GetString(varAuthKeysPath)
}

// GetOSOClusters returns a map of OSO cluster configurations by cluster API URL
func (c *ConfigurationData) GetOSOClusters() map[string]OSOCluster {
// Lock for reading because config file watcher can update cluster configuration
Expand Down Expand Up @@ -509,7 +527,7 @@ func (c *ConfigurationData) setConfigDefaults() {
// Misc
//-----

// Enable development related features, e.g. token generation endpoint
// Enable development related features
c.v.SetDefault(varDeveloperModeEnabled, false)

c.v.SetDefault(varLogLevel, defaultLogLevel)
Expand All @@ -521,6 +539,8 @@ func (c *ConfigurationData) setConfigDefaults() {

// prod-preview or prod
c.v.SetDefault(varEnvironment, "local")

c.v.SetDefault(varAuthKeysPath, "/token/keys")
}

// GetPostgresHost returns the postgres host as set via default, config file, or environment variable
Expand Down Expand Up @@ -606,9 +626,9 @@ func (c *ConfigurationData) GetMetricsHTTPAddress() string {
return c.v.GetString(varMetricsHTTPAddress)
}

// IsPostgresDeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable),
// DeveloperModeEnabled returns if development related features (as set via default, config file, or environment variable),
// e.g. token generation endpoint are enabled
func (c *ConfigurationData) IsPostgresDeveloperModeEnabled() bool {
func (c *ConfigurationData) DeveloperModeEnabled() bool {
return c.v.GetBool(varDeveloperModeEnabled)
}

Expand All @@ -626,7 +646,7 @@ func (c *ConfigurationData) IsDBLogsEnabled() bool {
// For example a public key from Keycloak
// Returns false if in in Dev Mode
func (c *ConfigurationData) GetDevModePublicKey() (bool, []byte, string) {
if c.IsPostgresDeveloperModeEnabled() {
if c.DeveloperModeEnabled() {
return true, []byte(devModePublicKey), devModePublicKeyID
}
return false, nil, ""
Expand All @@ -647,7 +667,7 @@ func (c *ConfigurationData) IsLogJSON() bool {
if c.v.IsSet(varLogJSON) {
return c.v.GetBool(varLogJSON)
}
if c.IsPostgresDeveloperModeEnabled() {
if c.DeveloperModeEnabled() {
return false
}
return true
Expand Down
2 changes: 1 addition & 1 deletion controller/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package controller
import (
"github.com/fabric8-services/fabric8-cluster/app"
"github.com/fabric8-services/fabric8-cluster/configuration"
"github.com/fabric8-services/fabric8-cluster/errors"
"github.com/fabric8-services/fabric8-cluster/jsonapi"
"github.com/fabric8-services/fabric8-cluster/rest"
"github.com/fabric8-services/fabric8-cluster/token"
"github.com/fabric8-services/fabric8-common/errors"
"github.com/fabric8-services/fabric8-common/log"

"github.com/goadesign/goa"
Expand Down
7 changes: 3 additions & 4 deletions controller/status.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package controller

import (
"fmt"
"time"

"github.com/fabric8-services/fabric8-cluster/app"
"github.com/fabric8-services/fabric8-common/log"

"fmt"

"github.com/goadesign/goa"
"github.com/jinzhu/gorm"
)
Expand All @@ -22,7 +21,7 @@ var (
)

type statusConfiguration interface {
IsPostgresDeveloperModeEnabled() bool
DeveloperModeEnabled() bool
DefaultConfigurationError() error
}

Expand Down Expand Up @@ -55,7 +54,7 @@ func (c *StatusController) Show(ctx *app.ShowStatusContext) error {
StartTime: StartTime,
}

devMode := c.config.IsPostgresDeveloperModeEnabled()
devMode := c.config.DeveloperModeEnabled()
if devMode {
res.DevMode = &devMode
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
image: fabric8-services/fabric8-cluster:latest
command: -config /usr/local/cluster/etc/config.yaml
environment:
AUTH_POSTGRES_HOST: db
CLUSTER_POSTGRES_HOST: db
ports:
- "8087:8087"
networks:
Expand Down
3 changes: 0 additions & 3 deletions errors/doc.go

This file was deleted.

Loading

0 comments on commit b48c73d

Please sign in to comment.