Skip to content

Commit

Permalink
18254 - AUTH - Backend - Environment variables cleanup (#2958)
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer0422 authored Aug 12, 2024
1 parent 95ac078 commit e7d3e01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion auth-api/src/auth_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class _Config: # pylint: disable=too-few-public-methods
DB_NAME = os.getenv('DATABASE_NAME', '')
DB_HOST = os.getenv('DATABASE_HOST', '')
DB_PORT = os.getenv('DATABASE_PORT', '5432')
SQLALCHEMY_DATABASE_URI = f'postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{int(DB_PORT)}/{DB_NAME}'
if DB_UNIX_SOCKET := os.getenv('DATABASE_UNIX_SOCKET', None):
SQLALCHEMY_DATABASE_URI = f'postgresql+psycopg2://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?host={DB_UNIX_SOCKET}'
else:
SQLALCHEMY_DATABASE_URI = f'postgresql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{int(DB_PORT)}/{DB_NAME}'
SQLALCHEMY_ECHO = False
SQLALCHEMY_TRACK_MODIFICATIONS = False

Expand Down
4 changes: 3 additions & 1 deletion auth-api/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
# limitations under the License.
"""Provides the WSGI entry point for running the application
"""
import os
from auth_api import create_app


# Openshift s2i expects a lower case name of application
app = create_app() # pylint: disable=invalid-name

if __name__ == "__main__":
app.run()
server_port = os.environ.get('PORT', '8080')
app.run(debug=False, port=server_port, host='0.0.0.0')

0 comments on commit e7d3e01

Please sign in to comment.