Skip to content

Commit

Permalink
Merge pull request #6 from containerum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MargoTuleninova authored Oct 15, 2018
2 parents 72799c4 + 1d12a63 commit 9caa7cc
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ COPY --from=alpine /zoneinfo.zip /
# tls certificates
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENV CH_SOLUTIONS="impl" \
CH_SOLUTIONS_MIGRATIONS_PATH="migrations" \
CH_SOLUTIONS_TEXTLOG="true" \
CH_SOLUTIONS_DEBUG="true" \
CH_SOLUTIONS_DB="postgres" \
CH_SOLUTIONS_PG_LOGIN="solutions" \
CH_SOLUTIONS_PG_PASSWORD="" \
CH_SOLUTIONS_PG_ADDR="postgres:5432" \
CH_SOLUTIONS_PG_DBNAME="usermanager" \
CH_SOLUTIONS_PG_NOSSL=true \
CH_SOLUTIONS_KUBE_API_URL="http://kube-api:1214" \
CH_SOLUTIONS_RESOURCE_URL="http://resource-service:1213"
ENV SOLUTIONS="impl" \
MIGRATIONS_PATH="migrations" \
TEXTLOG="true" \
DEBUG="true" \
DB="postgres" \
PG_LOGIN="solutions" \
PG_PASSWORD="" \
PG_ADDR="postgres:5432" \
PG_DBNAME="usermanager" \
PG_NOSSL=true \
KUBE_API_URL="http://kube-api:1214" \
RESOURCE_URL="http://resource-service:1213"

EXPOSE 6767

Expand Down
30 changes: 15 additions & 15 deletions charts/solutions/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,35 @@ spec:
- name: {{ $key }}
value: {{ $val | quote }}
{{ end }}{{- end }}
{{- if .Values.env.local.CH_SOLUTIONS_PG_ADDR }}
- name: CH_SOLUTIONS_PG_ADDR
value: "{{ .Values.env.local.CH_SOLUTIONS_PG_ADDR }}"
{{- if .Values.env.local.PG_ADDR }}
- name: PG_ADDR
value: "{{ .Values.env.local.PG_ADDR }}"
{{- else }}
- name: CH_SOLUTIONS_PG_ADDR
- name: PG_ADDR
value: "{{ .Release.Name }}-postgresql:5432"
{{- end }}
{{- if .Values.env.local.CH_SOLUTIONS_KUBE_API_URL }}
- name: CH_SOLUTIONS_KUBE_API_URL
value: "{{ .Values.env.local.CH_SOLUTIONS_KUBE_API_URL }}"
{{- if .Values.env.local.KUBE_API_URL }}
- name: KUBE_API_URL
value: "{{ .Values.env.local.KUBE_API_URL }}"
{{- else }}
- name: CH_SOLUTIONS_KUBE_API_URL
- name: KUBE_API_URL
value: "http://{{ .Release.Name }}-kube:1214"
{{- end }}
{{- if .Values.env.local.CH_SOLUTIONS_RESOURCE_URL }}
- name: CH_SOLUTIONS_RESOURCE_URL
value: "{{ .Values.env.local.CH_SOLUTIONS_RESOURCE_URL }}"
{{- if .Values.env.local.RESOURCE_URL }}
- name: RESOURCE_URL
value: "{{ .Values.env.local.RESOURCE_URL }}"
{{- else }}
- name: CH_SOLUTIONS_RESOURCE_URL
- name: RESOURCE_URL
value: "http://{{ .Release.Name }}-resource:1213"
{{- end }}
{{- if .Values.env.local.CH_SOLUTIONS_PG_PASSWORD }}
- name: CH_SOLUTIONS_PG_PASSWORD
{{- if .Values.env.local.PG_PASSWORD }}
- name: PG_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: pg-password
{{- else if .Values.tags.platformdb }}
- name: CH_SOLUTIONS_PG_PASSWORD
- name: PG_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-postgresql
Expand Down
6 changes: 3 additions & 3 deletions charts/solutions/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.env.local.CH_SOLUTIONS_PG_PASSWORD }}
{{- if .Values.env.local.PG_PASSWORD }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -10,7 +10,7 @@ metadata:
heritage: {{ .Release.Service }}
type: Opaque
data:
{{- if .Values.env.local.CH_SOLUTIONS_PG_PASSWORD }}
pg-password: {{ .Values.env.local.CH_SOLUTIONS_PG_PASSWORD | b64enc }}
{{- if .Values.env.local.PG_PASSWORD }}
pg-password: {{ .Values.env.local.PG_PASSWORD | b64enc }}
{{- end }}
{{- end }}
20 changes: 10 additions & 10 deletions charts/solutions/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ service:

env:
global:
CH_SOLUTIONS_DEBUG: "false"
CH_SOLUTIONS_TEXTLOG: "false"
CH_SOLUTIONS_DB: "postgres"
CH_SOLUTIONS_PG_LOGIN: "solutions"
CH_SOLUTIONS_PG_DBNAME: "solutions"
CH_SOLUTIONS_PG_NOSSL: "true"
DEBUG: "false"
TEXTLOG: "false"
DB: "postgres"
PG_LOGIN: "solutions"
PG_DBNAME: "solutions"
PG_NOSSL: "true"
local:
CH_SOLUTIONS_PG_ADDR: "postgres-master.postgres.svc:5432"
CH_SOLUTIONS_KUBE_API_URL: "http://kube:1214"
CH_SOLUTIONS_RESOURCE_URL: "http://resource:1213"
CH_SOLUTIONS_PG_PASSWORD:
PG_ADDR: "postgres-master.postgres.svc.cluster.local:5432"
KUBE_API_URL: "http://kube-api:1214"
RESOURCE_URL: "http://resource-service:1213"
PG_PASSWORD:

postgresql:
persistence:
Expand Down
28 changes: 14 additions & 14 deletions cmd/solutions/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,78 +32,78 @@ const (

var flags = []cli.Flag{
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_PORT",
EnvVar: "PORT",
Name: portFlag,
Value: "6767",
Usage: "port for solutions server",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS",
EnvVar: "SOLUTIONS",
Name: solutionsFlag,
Value: "impl",
Usage: "Solutions impl",
},
cli.BoolFlag{
EnvVar: "CH_SOLUTIONS_DEBUG",
EnvVar: "DEBUG",
Name: debugFlag,
Usage: "Start the server in Debug mode",
},
cli.BoolFlag{
EnvVar: "CH_SOLUTIONS_TEXTLOG",
EnvVar: "TEXTLOG",
Name: textlogFlag,
Usage: "Display output log in text format",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_DB",
EnvVar: "DB",
Name: dbFlag,
Value: "postgres",
Usage: "DB for project",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_PG_LOGIN",
EnvVar: "PG_LOGIN",
Name: dbPGLoginFlag,
Usage: "DB Login (PostgreSQL)",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_PG_PASSWORD",
EnvVar: "PG_PASSWORD",
Name: dbPGPasswordFlag,
Usage: "DB Password (PostgreSQL)",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_PG_ADDR",
EnvVar: "PG_ADDR",
Name: dbPGAddrFlag,
Usage: "DB Address (PostgreSQL)",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_PG_DBNAME",
EnvVar: "PG_DBNAME",
Name: dbPGNameFlag,
Usage: "DB name (PostgreSQL)",
},
cli.BoolFlag{
EnvVar: "CH_SOLUTIONS_PG_NOSSL",
EnvVar: "PG_NOSSL",
Name: dbPGNoSSLFlag,
Usage: "DB disable ssl (PostgreSQL)",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_MIGRATIONS_PATH",
EnvVar: "MIGRATIONS_PATH",
Name: dbMigrationsFlag,
Value: "../../pkg/migrations/",
Usage: "Location of DB migrations",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_KUBE_API_URL",
EnvVar: "KUBE_API_URL",
Name: kubeURLFlag,
Value: "http://kube-api:1214",
Usage: "Kube-API service URL",
},
cli.StringFlag{
EnvVar: "CH_SOLUTIONS_RESOURCE_URL",
EnvVar: "RESOURCE_URL",
Name: resourceURLFlag,
Value: "http://resource-service:1213",
Usage: "Resource service URL",
},
cli.BoolFlag{
EnvVar: "CH_SOLUTIONS_CORS",
EnvVar: "CORS",
Name: "cors",
Usage: "enable CORS",
},
Expand Down
4 changes: 2 additions & 2 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func CreateRouter(ss *server.SolutionsService, status *model.ServiceStatus, enab
e := gin.New()
e.GET("/status", httputil.ServiceStatus(status))
initMiddlewares(e, ss)
initRoutes(e, status, enableCORS)
initRoutes(e, enableCORS)
return e
}

Expand All @@ -41,7 +41,7 @@ func initMiddlewares(e *gin.Engine, ss *server.SolutionsService) {
}

// SetupRoutes sets up http router needed to handle requests from clients.
func initRoutes(app *gin.Engine, status *model.ServiceStatus, enableCORS bool) {
func initRoutes(app *gin.Engine, enableCORS bool) {
requireIdentityHeaders := httputil.RequireHeaders(solerrors.ErrRequiredHeadersNotProvided, httputil.UserIDXHeader, httputil.UserRoleXHeader)

if enableCORS {
Expand Down

0 comments on commit 9caa7cc

Please sign in to comment.