Skip to content

Commit

Permalink
Update vote to use environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mbruntink committed Aug 16, 2020
1 parent 143275a commit a45ea84
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vote/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
option_a = os.getenv('OPTION_A', "Cats")
option_b = os.getenv('OPTION_B', "Dogs")
hostname = socket.gethostname()
sd_endpoint = os.getenv('COPILOT_SERVICE_DISCOVERY_ENDPOINT')
redis_host = "redis.{}".format(sd_endpoint)

app = Flask(__name__)

def get_redis():
if not hasattr(g, 'redis'):
g.redis = Redis(host="redis", db=0, socket_timeout=5)
g.redis = Redis(host=redis_host, db=0, socket_timeout=5)
return g.redis

@app.route("/", methods=['POST','GET'])
Expand Down

0 comments on commit a45ea84

Please sign in to comment.