1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

mongodb_conn load env.MONGO_DB_URI

This commit is contained in:
Jeremías 2021-03-16 13:22:06 -03:00 committed by Lars Kruse
parent 842acaef1a
commit 6ee90f2ee4

View file

@ -18,6 +18,11 @@ Default for host is 127.0.0.1 and port 27017 and will work without being defined
env.username user
env.password P@55w0rd
or
[mongodb_conn]
env.MONGO_DB_URI mongodb://user:passwd@127.0.0.1:27017
=head1 AUTHOR
Alban Espie-Guillon <alban.espie@alterway.fr>
@ -42,6 +47,9 @@ import pymongo
def _get_connections():
if 'MONGO_DB_URI' in os.environ:
conn = pymongo.MongoClient(os.environ['MONGO_DB_URI'])
else:
host = os.environ.get('host', '127.0.0.1')
port = os.environ.get('port', 27017)
username = os.environ.get('username', '')