esl / MongooseICE

STUN/TURN server written in Elixir
https://www.erlang-solutions.com/products/mongooseim.html
Other
118 stars 15 forks source link

Environment Values are ignored when built as "dev", but are picked up properly in "prod" #58

Closed RobertSwirsky closed 6 years ago

RobertSwirsky commented 6 years ago

My environment variables:

Name                           Value
----                           -----
MONGOOSEICE_UDP_BIND_IP        0.0.0.0
MONGOOSEICE_UDP_PORT           3478
MONGOOSEICE_LOGLEVEL           debug
MIX_ENV                        dev

cleaned and built, I see this:

D:\repos\MongooseICE [master ≡ +2 ~1 -0 !]> mix clean
D:\repos\MongooseICE [master ≡ +2 ~1 -0 !]> iex.bat -S mix
Compiling 29 files (.ex)
Generated mongooseice app

14:49:41.138 [info]  Starting STUN/TURN server (127.0.0.1:12100) with relay_ip: 127.0.0.1

14:49:41.144 [info]  Starting STUN/TURN server (127.0.0.1:12200) with relay_ip: 127.0.0.1
Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)

switched to prod:

Name                           Value
----                           -----
MONGOOSEICE_UDP_BIND_IP        0.0.0.0
MONGOOSEICE_UDP_PORT           3478
MONGOOSEICE_LOGLEVEL           debug
MIX_ENV                        prod
D:\repos\MongooseICE [master ≡ +2 ~1 -0 !]> mix clean
D:\repos\MongooseICE [master ≡ +2 ~1 -0 !]> iex.bat -S mix
Compiling 29 files (.ex)
Generated mongooseice app

14:50:47.222 [info]  Starting STUN/TURN server (0.0.0.0:3478) with relay_ip: 127.0.0.1
Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)

Other oddities:

Here's the commit I'm building off of:

D:\repos\MongooseICE [master ≡ +2 ~1 -0 !]> git show -s
commit 4c2792b2e01ccff377c8f78b131a5ca2b064f39b
Author: Arkadiusz Gil <arkadiusz.gil@erlang-solutions.com>
Date:   Mon Sep 25 14:30:25 2017 +0200

    Include logo and homepage in the docs
arkgil commented 6 years ago

Hi @chatterbeak 🙂 First of all, thank you for beautiful issue description 💙

Environment variables you've set are only used for configuring production build. If you take a look at config/prod.exs file you can see that :mongooseice application is configured using those environment variables. That's why it won't work in dev environment.

Port used when starting in dev isn't documented, but the STUN/TURN listeners started there are only used for debugging purposes when we are developing MongooseICE. Take a look at config/dev.exs file and you'll see configured :servers option. This is also why you see "Starting ..." message twice - because two listeners are started, each on different port.

Regarding debug log messages - MongooseICE simply doesn't log that much - but you should see debug message when e.g. the client hasn't installed permission for some peer on the TURN port, but peer sends the data there anyway.

RobertSwirsky commented 6 years ago

Thanks. What threw me were those odd port numbers! They aren't listed as defaults in the documentation. It would help if in debug mode it would log whenever a connection is made (I just made that change locally). It's hard to know when I got my RTCPeerConnection call right and it's actually going out to the STUN server. Thanks for this project.

arkgil commented 6 years ago

I see. It might be a good idea to log more extensively in debug. Unfortunately I don't know when we'll have resources to handle that, but PRs, as always, are more than welcome 😄

Thanks for using MongooseICE 👍