marcoraddatz / homebridge-docker

Dockerized Homebridge. No plugins pre-defined, hassle-free setup. Read instructions!
Apache License 2.0
128 stars 47 forks source link

Add config to enable debug #3

Closed benzman81 closed 7 years ago

benzman81 commented 7 years ago

Would be nice to be able to turn on debug mode via configuration.

marcoraddatz commented 7 years ago

I think the best way would be to use Docker variables to set an environment? Or do you have another solution in mind?

benzman81 commented 7 years ago

I have no experence in configuring docker images, just know how to run and stop :-)) any solution would be great ;-)

marcoraddatz commented 7 years ago

Please have a look at the develop branch. It's now possible to set an environment via .env file. Does this work for you?

benzman81 commented 7 years ago

without the .env file homebridge didnt start

with the .env file with HOMEBRIDGE_ENV=debug it does not seem to start in debug mode

benzman81 commented 7 years ago

In a sample script it aways evaluates to the default start. If I change my sample to the following the correct start will be triggered:

# Start Homebridge if [ -z ${HOMEBRIDGE_ENV+x} ] then homebridge else case "$HOMEBRIDGE_ENV" in "debug" ) DEBUG=* homebridge -D -P $plugin_folder ;; "development" ) homebridge -P $plugin_folder ;; "production" ) homebridge ;; esac fi

marcoraddatz commented 7 years ago

Many thanks. I changed the order and didn't updated the option from "-z" to "-n". The debug mode should now start again.

# Start Homebridge
if [ -n "$HOMEBRIDGE_ENV" ]
then
    case "$HOMEBRIDGE_ENV" in
        "debug" )
            DEBUG=* homebridge -D -P $plugin_folder ;;
        "development" )
            homebridge -P $plugin_folder ;;
        "production" )
            homebridge ;;
    esac
else
    homebridge
fi

From what I see, our code should work the same way... ;)

benzman81 commented 7 years ago

Yes, now its starting in debug mode. Thx.