container env variables for db
This commit is contained in:
parent
fb968853b5
commit
564a2c61df
@ -16,4 +16,7 @@ WORKDIR /app
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENV POSTGRES_HOST=127.0.0.1
|
||||||
|
ENV POSTGRES_PORT=5432
|
||||||
|
|
||||||
CMD ["gunicorn","--config", "gunicorn_config.py", "app:app"]
|
CMD ["gunicorn","--config", "gunicorn_config.py", "app:app"]
|
||||||
|
@ -5,4 +5,4 @@ podman pod create --name aliexpress -p 8080:8080
|
|||||||
|
|
||||||
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" -v /home/fire/Downloads/db:/var/lib/postgresql/data --name ali-db docker.io/postgres
|
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" -v /home/fire/Downloads/db:/var/lib/postgresql/data --name ali-db docker.io/postgres
|
||||||
|
|
||||||
podman run -d --pod=aliexpress --name ali-app alipricetrack:1.0.0
|
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name ali-app alipricetrack:1.0.0
|
||||||
|
@ -7,8 +7,17 @@ app = Flask(__name__)
|
|||||||
|
|
||||||
def get_conf():
|
def get_conf():
|
||||||
'''return settings in settings.yaml file'''
|
'''return settings in settings.yaml file'''
|
||||||
|
settings = dict()
|
||||||
with open(os.path.dirname(os.path.realpath(__file__))+"/settings.yaml", 'r') as conf_file:
|
with open(os.path.dirname(os.path.realpath(__file__))+"/settings.yaml", 'r') as conf_file:
|
||||||
settings = yaml.safe_load(conf_file)
|
settings = yaml.safe_load(conf_file)
|
||||||
|
settings["db"] = {
|
||||||
|
"host": os.environ.get('POSTGRES_HOST'),
|
||||||
|
"port": os.environ.get('POSTGRES_PORT'),
|
||||||
|
"database": os.environ.get('POSTGRES_DB'),
|
||||||
|
"user": os.environ.get('POSTGRES_USER'),
|
||||||
|
"password": os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
}
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
@app.route('/init')
|
@app.route('/init')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user