20 lines
628 B
Python
20 lines
628 B
Python
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 |