Fixed environment variable
This commit is contained in:
1 parent
144ccb89c3
commit
817351c034
1 file changed
+3
-2
+3
-2
@@ -8,8 +8,7 @@ from mysql.connector import Error, pooling
|
|||||||
from mysql.connector.pooling import MySQLConnection, MySQLConnectionPool
|
from mysql.connector.pooling import MySQLConnection, MySQLConnectionPool
|
||||||
from secret_manager import get_secret
|
from secret_manager import get_secret
|
||||||
|
|
||||||
db_username = get_secret("/etc/secrets/db_username")
|
|
||||||
db_password = get_secret("/etc/secrets/db_password")
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -27,6 +26,8 @@ def get_mysql_config():
|
|||||||
"""Returns a MYSQL config because creating it on module import lead to the environment variable not being available"""
|
"""Returns a MYSQL config because creating it on module import lead to the environment variable not being available"""
|
||||||
db_host = os.getenv("DB_HOST", "localhost")
|
db_host = os.getenv("DB_HOST", "localhost")
|
||||||
db_database = os.getenv("DB_DATABASE","app")
|
db_database = os.getenv("DB_DATABASE","app")
|
||||||
|
db_username = get_secret(os.getenv("DB_USERNAME",""),"/etc/secrets/db_username")
|
||||||
|
db_password = get_secret(os.getenv("DB_PASSWORD",""),"/etc/secrets/db_password")
|
||||||
return {
|
return {
|
||||||
"host": db_host,
|
"host": db_host,
|
||||||
"user": db_username,
|
"user": db_username,
|
||||||
|
|||||||
Reference in new issue
Block a user