first commit
This commit is contained in:
20
streamlit_dashboard/auth_config_loader.py
Normal file
20
streamlit_dashboard/auth_config_loader.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import yaml
|
||||
from streamlit_authenticator import Authenticate
|
||||
from yaml.loader import SafeLoader
|
||||
import streamlit_authenticator as stauth
|
||||
|
||||
def load_auth_config(config_path) -> Authenticate:
|
||||
try:
|
||||
with open(config_path) as file:
|
||||
config = yaml.load(file, Loader=SafeLoader)
|
||||
|
||||
authenticator = stauth.Authenticate(
|
||||
config['credentials'],
|
||||
config['cookie']['name'],
|
||||
config['cookie']['key'],
|
||||
config['cookie']['expiry_days'],
|
||||
auto_hash = True
|
||||
)
|
||||
return authenticator
|
||||
except FileNotFoundError:
|
||||
return None #pyright:ignore
|
||||
Reference in New Issue
Block a user