1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

Secrets editor (#672)

* Secrets editor

* Check file exists
This commit is contained in:
Nikolay Vasilchuk
2019-10-13 13:57:28 +03:00
committed by Otto Winter
parent 57bee74225
commit 7c31592850
3 changed files with 14 additions and 6 deletions

View File

@@ -530,9 +530,12 @@ class EditRequestHandler(BaseHandler):
@authenticated
@bind_config
def get(self, configuration=None):
# pylint: disable=no-value-for-parameter
with open(settings.rel_path(configuration), 'r') as f:
content = f.read()
filename = settings.rel_path(configuration)
content = ''
if os.path.isfile(filename):
# pylint: disable=no-value-for-parameter
with open(filename, 'r') as f:
content = f.read()
self.write(content)
@authenticated