JI511 / Personal_Fitness

Personal Python project to improve skills and explore different libraries. Open to any and all contributions. Using a local database with sqlite3 to learn SQL.
MIT License
0 stars 0 forks source link

Config File #61

Closed mdamonconnolly closed 5 years ago

mdamonconnolly commented 5 years ago

This patch adds a config file.

The config file stores the constants data on disk so that it is persistent across multiple runs of the program. I've opted to not store the querys in the config since that's unrelated to configuration but I have moved the database path (and the other newly added paths) to the config file.

The config file not only contributes to solving issue #27 but also can be used in future for issues #26 #19 and #56

I've also added pathlib as, from what I've found after searching, it's considered the more "correct" way of checking file existence rather than using os.

JI511 commented 5 years ago

I removed the paths from config file. For Issue 27, what I meant by optional param was a path that could be passed in upon program start up, so for instance 'python Personal_Fitness.py -path my_path' if the user wanted to use a different DB. The log file will always be the same so no need for the path to be different. The backup_db folder will also always be the same so it can just be hard coded. The water option is a good example of what I was thinking of for a config file.

JI511 commented 5 years ago

Also changed .cfg to .ini file type. Looks like online that is how configuration files are recognized.

mdamonconnolly commented 5 years ago

Thanks for the feedback!

re: creating a new .ini file if one did not slready exist, didn't it already do this at the top of the entry point in personal_fitness.py?

JI511 commented 5 years ago

Yes, but I just moved the check into the read function so you don’t have to call both init and read.

On Sat, Aug 17, 2019 at 7:29 PM Damon Connolly notifications@github.com wrote:

Thanks for the feedback!

re: creating a new .ini file if one did not slready exist, didn't it already do this at the top of the entry point in personal_fitness.py?

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/JI511/Personal_Fitness/pull/61?email_source=notifications&email_token=ACDK2NM6DJ5BP63WVSZZEGDQFCJYNA5CNFSM4IMLXDAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4QV34Q#issuecomment-522280434, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDK2NKJEIWDLBAEMES2B23QFCJYNANCNFSM4IMLXDAA .