@@ -25,11 +25,10 @@ def find_apps():
2525 continue
2626 file = open (file_path , "r" )
2727 content = file .read ()
28- match_proxy (content , file_path , apps )
29- match_auth (apps , auths )
28+ match_proxy (apps , auths , content , file_path )
3029 return apps , auths
3130
32- def match_proxy (content , file_path , apps ):
31+ def match_proxy (apps , auths , content , file_path ):
3332 results = re .finditer (PROXY_REGEX , content )
3433 for result in results :
3534 params = result .groupdict ()
@@ -39,22 +38,19 @@ def match_proxy(content, file_path, apps):
3938 if file_path .startswith ("/config/nginx/site-confs/" ) or file_path .endswith (".conf" ):
4039 file_path = "auto-proxy" if file_path .startswith ("/etc/nginx/http.d/" ) else file_path
4140 apps [app ].add (file_path )
41+ match_auth (auths , app , file_path , content )
4242
43- def match_auth (apps , auths ):
44- for app , file_paths in apps .items ():
45- for file_path in file_paths :
46- file = open (file_path , "r" )
47- content = file .read ()
48- if re .findall (AUTHELIA_REGEX , content ):
49- auths [app ][file_path ] = "Authelia"
50- elif re .findall (AUTHENTIK_REGEX , content ):
51- auths [app ][file_path ] = "Authentik"
52- elif re .findall (BASIC_AUTH_REGEX , content ):
53- auths [app ][file_path ] = "Basic Auth"
54- elif re .findall (LDAP_REGEX , content ):
55- auths [app ][file_path ] = "LDAP"
56- else :
57- auths [app ][file_path ] = "No Auth"
43+ def match_auth (auths , app , file_path , content ):
44+ if re .findall (AUTHELIA_REGEX , content ):
45+ auths [app ][file_path ] = "Authelia"
46+ elif re .findall (AUTHENTIK_REGEX , content ):
47+ auths [app ][file_path ] = "Authentik"
48+ elif re .findall (BASIC_AUTH_REGEX , content ):
49+ auths [app ][file_path ] = "Basic Auth"
50+ elif re .findall (LDAP_REGEX , content ):
51+ auths [app ][file_path ] = "LDAP"
52+ else :
53+ auths [app ][file_path ] = "No Auth"
5854
5955def is_available (url ):
6056 s = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
0 commit comments