forked from MisterCalvin/mkdocs-plex-guide-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
26 lines (23 loc) · 942 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
from datetime import datetime
def define_env(env):
"""
This hook is called when the config is loading.
"""
username = os.getenv('GITHUB_REPOSITORY_OWNER', 'Ghost')
repo_name = os.getenv('GITHUB_REPOSITORY', 'mkdocs-plex-guide-template').split('/')[-1]
current_year = datetime.now().year
# Explicitly check for missing or empty values and assign defaults
request_url = os.getenv('REQUEST_URL') or "request.example.com"
plex_url = os.getenv('PLEX_URL') or "plex.example.com"
plex_libraries = os.getenv('PLEX_LIBRARIES') or "Movies and TV Shows"
noreply_email = os.getenv('NOREPLY_EMAIL') or "[email protected]"
env.variables.update({
"username": username,
"repo_name": repo_name,
"year": current_year,
"request_url": request_url,
"plex_url": plex_url,
"plex_libraries": plex_libraries,
"noreply_email": noreply_email,
})