From cb050b92c814ac677657f38c9126d1cc35fefe20 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mon, 31 Oct 2016 10:47:50 -0400 Subject: [PATCH] Use a less hacky way to determine if we're running inside Docker. --- fedmsg.d/module_build_service.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fedmsg.d/module_build_service.py b/fedmsg.d/module_build_service.py index aabbf2ba..27d948d1 100644 --- a/fedmsg.d/module_build_service.py +++ b/fedmsg.d/module_build_service.py @@ -1,4 +1,4 @@ -import socket +import os config = { # Just for dev. @@ -37,9 +37,8 @@ config = { } # Try to figure out if we're running inside a docker-compose container -fqdn = socket.getfqdn() -# If we are, then fqdn is something like '4c62a35c9f9c' -if fqdn.isalnum() and len(fqdn) == 12: +# http://stackoverflow.com/questions/20010199 +if os.path.exists('/.dockerenv'): config['endpoints']['relay_outbound'] = ["tcp://fedmsg-relay:2001"] config['relay_inbound'] = ["tcp://fedmsg-relay:2003"] else: