Skip to content
Browse files

get configuration from current environment

  • Loading branch information...
1 parent bb7791e commit 6ac1f2014e97996e15d4c6f24ae963ef3e93411c @andreisavu committed
Showing with 21 additions and 6 deletions.
  1. +7 −2 check_all.py
  2. +7 −2 put_all.py
  3. +7 −2 test_sequential.py
View
9 check_all.py
@@ -22,8 +22,13 @@
from zkmq import ZooKeeper, Consumer
def create_zk():
- return ZooKeeper("localhost:2181,localhost:2182,localhost:2183,"\
- "localhost:2184,localhost:2185")
+ quorum = "localhost:2181,localhost:2182,localhost:2183,"\
+ "localhost:2184,localhost:2185"
+
+ if 'ZOOKEEPER_QUORUM' in os.environ:
+ quorum = os.environ['ZOOKEEPER_QUORUM']
+
+ return ZooKeeper(quorum)
def main():
zk = create_zk()
View
9 put_all.py
@@ -22,8 +22,13 @@
from zkmq import ZooKeeper, Producer
def create_zk():
- return ZooKeeper("localhost:2181,localhost:2182,localhost:2183,"\
- "localhost:2184,localhost:2185")
+ quorum = "localhost:2181,localhost:2182,localhost:2183,"\
+ "localhost:2184,localhost:2185"
+
+ if 'ZOOKEEPER_QUORUM' in os.environ:
+ quorum = os.environ['ZOOKEEPER_QUORUM']
+
+ return ZooKeeper(quorum)
def main():
zk = create_zk()
View
9 test_sequential.py
@@ -26,8 +26,13 @@ def main():
return parent_main() if os.fork() else child_main()
def create_zk():
- return ZooKeeper("localhost:2181,localhost:2182,localhost:2183,"\
- "localhost:2184,localhost:2185")
+ quorum = "localhost:2181,localhost:2182,localhost:2183,"\
+ "localhost:2184,localhost:2185"
+
+ if 'ZOOKEEPER_QUORUM' in os.environ:
+ quorum = os.environ['ZOOKEEPER_QUORUM']
+
+ return ZooKeeper(quorum)
def parent_main():
zk = create_zk()

0 comments on commit 6ac1f20

Please sign in to comment.
Something went wrong with that request. Please try again.