Make port a configuration option

Issue #2 resolved
tom enos created an issue

This is something that I found we could do with a small addition to code.py

class Application(web.application):
    def run(self, port=8080, *middleware):
        func = self.wsgifunc(*middleware)

        return web.httpserver.runsimple(func, ('0.0.0.0', port))


if __name__ == "__main__":
    web.config.debug = False
    app = Application(urls, globals())
    app.run(port=slc.webui_port)

    sch.stopScheduler()
    slc.lightsoff()    

In the default config I created another section
[webui]
port = 80

and added another section in configuration manage to process it. And slc received a new variable.

Doing this would also allow for adding back in the command line options for synchronized_lights.py so that it could be run with or without the webui

Comments (7)

  1. tom enos reporter

    Adding a section to the config would also allow for setting an upload directory instead of changing it in code.py

  2. Stephen Burning repo owner

    Hey Tom, i like your ideas. My plan is to hopefully get the webui to have everything that the base code has so there is no need for command line at all. It would be soooo much easier for a user to just install an image provided by us with the code already on it and then just open a web page to set everything up with a gui. Not everyone sees it this way and thats why i put my code in my own bit bucket instead of the master. I don't want to muddy up Todd's master branch. So i would personally like to not have to worry about running it the command line way or the webui way, because my goal is to only have a webui way.

  3. tom enos reporter

    I'll keep it in mind that you do not want a command line interface if I submit any pull request to you.
    But the above snippet does help to eliminate at least one command line parameter.

    Would you mind me contributing to your branch?

  4. Log in to comment