gchenuet / nest-datagraph

Nest thermostat dashboard and graph charts
MIT License
36 stars 17 forks source link

Feature - split py settings into seperate file that can be ignored by git #21

Closed ryan-jacobs closed 6 years ago

ryan-jacobs commented 6 years ago

Addresses #20 by separating settings/secretes from polling script into file that can be gitignored.

gchenuet commented 6 years ago

Nice idea !

Maybe use an INI/YAML format for python settings file and using the open function:

        config = os.path.join(os.path.dirname(__file__), "settings.yaml")
        with open(config, "r") as f:
            settings = yaml.load(f)

What do you think ?

Thanks for your help, really appreciate !

ryan-jacobs commented 6 years ago

Yep, good point. Thinking more, perhaps it would be best to point both the frontend and backend to the a single canonical settings file. After all, many settings (for DB and NEST API) are common for each. In this regard I certainly prefer yaml (as my background is PHP and frameworks like Drupal and Symfony), but in the interest of time it may be easiest to stick to ini. From what I can see both php and python have native parsing for ini, and I think additional libs would be needed for yaml. Anyway, I'm pretty new to python so I may not be seeing all the variables involved there.

ryan-jacobs commented 6 years ago

I just pushed a proof-of-concept for canonical settings (in ini) format. This may still be a little rough, but it's something specific for additional discussion.