Development
This commit is contained in:
parent
1beb660be1
commit
025adb9f15
4 changed files with 15 additions and 7 deletions
|
|
@ -31,6 +31,19 @@ def get_host_utc_offset():
|
|||
return time.localtime().tm_gmtoff
|
||||
|
||||
|
||||
def get_host_timezone():
|
||||
"""Return the host timezone name (e.g. 'America/New_York'), or '' if unknown."""
|
||||
tz = os.environ.get('TZ', '').strip()
|
||||
if tz:
|
||||
return tz
|
||||
try:
|
||||
with open('/etc/timezone') as f:
|
||||
return f.read().strip()
|
||||
except OSError:
|
||||
pass
|
||||
return ''
|
||||
|
||||
|
||||
def get_credentials_key():
|
||||
"""Return a Fernet-compatible key derived from the CREDENTIALS_KEY environment variable,
|
||||
or None if not set. SHA-256 hashes the raw string to produce 32 bytes, which are then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue