From 85c9c4bacc6d64c1e6600603346d7653e66d727b Mon Sep 17 00:00:00 2001 From: PCoder Date: Fri, 13 Sep 2019 12:07:53 +0530 Subject: [PATCH] Supply app port via config --- README.md | 9 +++++++++ config.py | 1 + ucloud-pay.py | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2969096..90511ee 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,15 @@ The pay module for the ucloud +## Getting started + +``` +pipenv shell +pipenv install +ETCD_HOST=127.0.0.1 ETCD_PORT=2379 python ucloud-pay.py +``` + + Currently handles very basic features, such as: 1. Adding of products diff --git a/config.py b/config.py index 6043a2a..9773f0a 100644 --- a/config.py +++ b/config.py @@ -13,3 +13,4 @@ logging.basicConfig( etcd_client = Etcd3Wrapper(host=config("ETCD_HOST"), port=config("ETCD_PORT")) +APP_PORT = config("APP_PORT", 5000) diff --git a/ucloud-pay.py b/ucloud-pay.py index a0bc740..601a8ee 100644 --- a/ucloud-pay.py +++ b/ucloud-pay.py @@ -1,7 +1,7 @@ import json from flask import Flask, request from flask_restful import Resource, Api -from config import etcd_client as client, logging +from config import etcd_client as client, logging, APP_PORT app = Flask(__name__) api = Api(app) @@ -41,4 +41,4 @@ api.add_resource(ListProducts, "/product/list") api.add_resource(AddProduct, "/product/add") if __name__ == '__main__': - app.run(host="::", debug=True) + app.run(host="::", port=APP_PORT, debug=True)