|
|
@ -242,18 +242,21 @@ class EnvService:
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def get_api_db():
|
|
|
|
def get_api_db():
|
|
|
|
user_input_api_keys = EnvService.get_user_input_api_keys()
|
|
|
|
user_input_api_keys = EnvService.get_user_input_api_keys()
|
|
|
|
user_key_db = None
|
|
|
|
user_key_db = None
|
|
|
|
if user_input_api_keys:
|
|
|
|
if user_input_api_keys:
|
|
|
|
print("This server was configured to enforce user input API keys. Doing the required database setup now")
|
|
|
|
print(
|
|
|
|
|
|
|
|
"This server was configured to enforce user input API keys. Doing the required database setup now"
|
|
|
|
|
|
|
|
)
|
|
|
|
# Get user_key_db from environment variable
|
|
|
|
# Get user_key_db from environment variable
|
|
|
|
user_key_db_path = EnvService.get_user_key_db_path()
|
|
|
|
user_key_db_path = EnvService.get_user_key_db_path()
|
|
|
|
# Check if user_key_db_path is valid
|
|
|
|
# Check if user_key_db_path is valid
|
|
|
|
if not user_key_db_path:
|
|
|
|
if not user_key_db_path:
|
|
|
|
print("No user key database path was provided. Defaulting to user_key_db.sqlite")
|
|
|
|
print(
|
|
|
|
|
|
|
|
"No user key database path was provided. Defaulting to user_key_db.sqlite"
|
|
|
|
|
|
|
|
)
|
|
|
|
user_key_db_path = "user_key_db.sqlite"
|
|
|
|
user_key_db_path = "user_key_db.sqlite"
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# append "user_key_db.sqlite" to USER_KEY_DB_PATH if it doesn't already end with .sqlite
|
|
|
|
# append "user_key_db.sqlite" to USER_KEY_DB_PATH if it doesn't already end with .sqlite
|
|
|
@ -265,9 +268,6 @@ class EnvService:
|
|
|
|
return user_key_db
|
|
|
|
return user_key_db
|
|
|
|
return user_key_db
|
|
|
|
return user_key_db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def get_deepl_token():
|
|
|
|
def get_deepl_token():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|