mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-17 08:02:36 +00:00
get rid of reading /var/domain
This commit is contained in:
parent
08e04ee601
commit
789a1c579c
|
@ -10,7 +10,6 @@ import portalocker
|
||||||
|
|
||||||
USERDATA_FILE = "/etc/nixos/userdata.json"
|
USERDATA_FILE = "/etc/nixos/userdata.json"
|
||||||
SECRETS_FILE = "/etc/selfprivacy/secrets.json"
|
SECRETS_FILE = "/etc/selfprivacy/secrets.json"
|
||||||
DOMAIN_FILE = "/var/domain"
|
|
||||||
|
|
||||||
|
|
||||||
class UserDataFiles(Enum):
|
class UserDataFiles(Enum):
|
||||||
|
@ -21,10 +20,9 @@ class UserDataFiles(Enum):
|
||||||
|
|
||||||
|
|
||||||
def get_domain():
|
def get_domain():
|
||||||
"""Get domain from /var/domain without trailing new line"""
|
"""Get domain from userdata.json"""
|
||||||
with open(DOMAIN_FILE, "r", encoding="utf-8") as domain_file:
|
with ReadUserData() as user_data:
|
||||||
domain = domain_file.readline().rstrip()
|
return user_data["domain"]
|
||||||
return domain
|
|
||||||
|
|
||||||
|
|
||||||
class WriteUserData(object):
|
class WriteUserData(object):
|
||||||
|
|
Loading…
Reference in a new issue