Skip to content

Commit

Permalink
Align with other settings.py files
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Seichter committed Jul 30, 2024
1 parent ef93448 commit 5974abb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
import boto3
import os

CONFIGFILE = "config.json"
CONFIGFILE = 'config.json'


def create_config():
# create the config file if it does not exist
try:
with open(CONFIGFILE, "r") as f:
with open(CONFIGFILE, 'r') as f:
data = json.load(f)
except FileNotFoundError:
with open(CONFIGFILE, "w") as f:
f.write("{}")
with open(CONFIGFILE, 'w') as f:
f.write('{}')

with open(CONFIGFILE, "r") as f:
with open(CONFIGFILE, 'r') as f:
data = json.load(f)

if "aws_access_key_id" not in data:
Expand All @@ -47,20 +47,20 @@ def create_config():
if "check_for_updates" not in data:
data["check_for_updates"] = True

with open(CONFIGFILE, "w") as f:
with open(CONFIGFILE, 'w') as f:
json.dump(data, f, indent=4, sort_keys=True)


def read_config():
with open(CONFIGFILE, "r") as f:
with open(CONFIGFILE, 'r') as f:
return json.load(f)


def save_config(key, value):
with open(CONFIGFILE, "r") as f:
with open(CONFIGFILE, 'r') as f:
data = json.load(f)
data[key] = value
with open(CONFIGFILE, "w") as f:
with open(CONFIGFILE, 'w') as f:
json.dump(data, f, indent=4, sort_keys=True)


Expand Down

0 comments on commit 5974abb

Please sign in to comment.