diff --git a/app/api/views.py b/app/api/views.py index 5be645f..481ca66 100755 --- a/app/api/views.py +++ b/app/api/views.py @@ -46,24 +46,11 @@ LOGGER = logging.getLogger('munkiwebadmin') -try: - PROXY_ADDRESS = settings.PROXY_ADDRESS -except AttributeError: - PROXY_ADDRESS = "" - try: TIMEOUT = settings.TIMEOUT except AttributeError: TIMEOUT = 20 -proxies = {} -if PROXY_ADDRESS != "": - proxies = { - "http": 'http://'+PROXY_ADDRESS, - "https": 'https://'+PROXY_ADDRESS - } - - def normalize_value_for_filtering(value): '''Converts value to a list of strings''' if isinstance(value, (int, float, bool, str, dict)): diff --git a/app/munkiwebadmin/settings.py b/app/munkiwebadmin/settings.py index 397646e..804c353 100755 --- a/app/munkiwebadmin/settings.py +++ b/app/munkiwebadmin/settings.py @@ -18,25 +18,17 @@ APPNAME = os.getenv('APPNAME', 'MunkiWebAdmin') MUNKI_REPO_DIR = os.getenv('MUNKI_REPO_DIR', '/munkirepo') MAKECATALOGS_PATH = os.getenv('MAKECATALOGS_PATH', '/munkitools/makecatalogs') -MEDIA_ROOT = os.path.join(MUNKI_REPO_DIR, 'icons') -ICONS_URL = MEDIA_URL -PROXY_ADDRESS = os.getenv('PROXY_ADDRESS', '') -DEFAULT_MANIFEST = os.getenv('DEFAULT_MANIFEST') -MUNKISCRIPTS_PATH = os.path.join(BASE_DIR, 'munkiscripts', 'build') -FIELD_ENCRYPTION_KEY = os.environ.get('FIELD_ENCRYPTION_KEY', 'VDKEyIzST-hbtX7rvA7LPue63E0XB0m3pZEFWKk0BKI=') +DEFAULT_MANIFEST = os.getenv('DEFAULT_MANIFEST', 'serial_number') REPO_MANAGEMENT_ONLY = os.getenv("REPO_MANAGEMENT_ONLY", 'False').lower() in ('true', '1', 't') -CLIENT_ID = os.getenv('CLIENT_ID', 'ID') -CLIENT_SECRET = os.getenv('CLIENT_SECRET', None) -TENANT_ID = os.getenv('TENANT_ID', None) - -# enable git integration -if os.path.isdir(os.path.join(MUNKI_REPO_DIR, '.git')): - GIT_PATH = '/usr/bin/git' - SECRET_KEY = os.environ.get("SECRET_KEY", "CHANGEME!!!") ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "localhost 127.0.0.1 [::1]").split(" ") CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS", "http://localhost").split(" ") +# Azure AD settings +CLIENT_ID = os.getenv('CLIENT_ID', 'ID') +CLIENT_SECRET = os.getenv('CLIENT_SECRET', None) +TENANT_ID = os.getenv('TENANT_ID', None) + # Azure App Service if os.environ.get('WEBSITE_HOSTNAME'): ALLOWED_HOSTS.append(os.environ.get('WEBSITE_HOSTNAME')) @@ -45,6 +37,13 @@ # debug mode DEBUG = os.getenv("DEBUG", 'False').lower() in ('true', '1', 't') +#not changing this +MUNKISCRIPTS_PATH = os.path.join(BASE_DIR, 'munkiscripts', 'build') +MEDIA_ROOT = os.path.join(MUNKI_REPO_DIR, 'icons') +ICONS_URL = MEDIA_URL +if os.path.isdir(os.path.join(MUNKI_REPO_DIR, '.git')): + GIT_PATH = '/usr/bin/git' + # CORS settings CORS_ORIGIN_ALLOW_ALL = DEBUG CORS_ORIGIN_WHITELIST = () diff --git a/app/reports/views.py b/app/reports/views.py index fcb1ffc..512de28 100755 --- a/app/reports/views.py +++ b/app/reports/views.py @@ -20,11 +20,6 @@ LOGGER = logging.getLogger('munkiwebadmin') -try: - PROXY_ADDRESS = settings.PROXY_ADDRESS -except AttributeError: - PROXY_ADDRESS = "" - try: DEFAULT_MANIFEST = settings.DEFAULT_MANIFEST except AttributeError: @@ -40,16 +35,6 @@ except AttributeError: ICONS_URL = "" -proxies = { - "http": PROXY_ADDRESS, - "https": PROXY_ADDRESS -} - -if PROXY_ADDRESS: - proxy = urllib.request.ProxyHandler(proxies) - opener = urllib.request.build_opener(proxy) - urllib.request.install_opener(opener) - def is_ajax(request): return request.META.get('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest' diff --git a/app/requirements.txt b/app/requirements.txt index 1872f2c..9b5f03c 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -2,7 +2,6 @@ django==4.2.11 psycopg2-binary==2.9.9 gunicorn==22.0.0 mysqlclient==2.2.4 -django-encrypted-model-fields==0.6.5 python-ldap==3.4.3 django-auth-ldap==4.5.0 django-cors-headers==4.2.0