murgo/steam-dissector — pull request #14 by zemm (2014-10-01 17:13:45+00:00)
Title: Support docker MongoDB linking env var

In order to run Dissector inside Docker container, it might be desirable to use MongoDB instance also running inside container. Specially so since for us, MongoDB is just a cache that can be purged at any time.

This change checks the presence of MONGO_PORT (I don't understand the point of this name!) -env var, which is set if mongo is linked with docker --link=mongocontainername:mongo ..., and uses it if MONGO_URI is not defined.

MongoDB connection details are now search in order as:

Connection:
1) MONGO_URI env var
2) MONGO_URI config key
3) MONGO_PORT env var
4) Do not try to connect

Database name search in order:
1) MONGO_DB env var
2) MONGO_DB config key
3) If found from MONGO_URI (mongodb://host:port/database)
4) "steam-dissector" default