Skip to content

Commit

Permalink
derive validateuser url
Browse files Browse the repository at this point in the history
  • Loading branch information
sbtaylor15 committed Mar 15, 2022
1 parent 9794a8b commit acaa972
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chart/ms-dep-pkg-r/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ name: ms-dep-pkg-r
description: Dependency Packages
type: application
icon: https://ortelius.github.io/ortelius-charts/logo.png
version: "10.0.0-build.43"
version: "10.0.0-build.44"
2 changes: 0 additions & 2 deletions chart/ms-dep-pkg-r/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ spec:
image: "{{ .Values.DockerRepo }}:{{ .Values.DockerTag }}"
imagePullPolicy: Always
env:
- name: VALIDATEUSER_URL
value: {{ .Values.ValidateUserUrl | default "http://ms-validate-user.{{ metadata.namespace }}.svc.cluster.local" }}
- name: DB_USER
valueFrom:
secretKeyRef:
Expand Down
7 changes: 6 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@
db_user = os.getenv("DB_USER", "postgres")
db_pass = os.getenv("DB_PASS", "postgres")
db_port = os.getenv("DB_PORT", "5432")
validateuser_url = os.getenv("VALIDATEUSER_URL", "http://localhost:5000")
validateuser_url = os.getenv('VALIDATEUSER_URL', None )

if (validateuser_url is None):
validateuser_host = os.getenv('MS_VALIDATE_USER_SERVICE_HOST', '127.0.0.1')
host = socket.gethostbyaddr(validateuser_host)[0]
validateuser_url = 'http://' + host + ':' + str(os.getenv('MS_VALIDATE_USER_SERVICE_PORT', 80))

engine = create_engine("postgresql+psycopg2://" + db_user + ":" + db_pass + "@" + db_host + ":" + db_port + "/" + db_name, pool_pre_ping=True)

Expand Down

0 comments on commit acaa972

Please sign in to comment.