Commit Graph

2 Commits

Author SHA1 Message Date
nico ee4cb50ba6
config value defaults
* config loads and reads the config file in the init method to reduce io operations
+ get method is now able to take 2 optional arguments, a request key and a definable default value
2020-02-10 00:06:59 +01:00
nico eaed97cf4f
utilize /etc/ directory
+ add config.py to read / touch create the etc config file

_read():
	tries to open the config files in read only mode to parse its contents.

_check():
	checks if the config file is present and then calls _read()
	if that is false it tries to touch create a new file.

	worst case scenario: file is present and holds content, the method assumes that the file isn't present. Therefore tries to touch-create a new file, if a file is against all odds present, only the mtime would be updated. Hence any file content would not be altered.

get():
	main method, calling _check()
	if a key is given return only the assigned value or None
	or return the whole dictionary
2020-02-03 20:49:52 +01:00