From c3e59ef0a37be4df3ed84c5baa1100857beea270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?dni=20=E2=9A=A1?= Date: Mon, 3 Oct 2022 16:40:57 +0200 Subject: [PATCH] config not needed anymore --- lnbits/config.py | 78 ------------------------------------------------ 1 file changed, 78 deletions(-) delete mode 100644 lnbits/config.py diff --git a/lnbits/config.py b/lnbits/config.py deleted file mode 100644 index fe8dabf9..00000000 --- a/lnbits/config.py +++ /dev/null @@ -1,78 +0,0 @@ -import importlib -import json -from os import getenv, path -from typing import List, Optional - -from pydantic import BaseSettings, Field - -wallets_module = importlib.import_module("lnbits.wallets") -wallet_class = getattr( - wallets_module, getenv("LNBITS_BACKEND_WALLET_CLASS", "VoidWallet") -) - -WALLET = wallet_class() - - -def list_parse_fallback(v): - try: - return json.loads(v) - except Exception as e: - replaced = v.replace(" ", "") - if replaced: - return replaced.split(",") - else: - return [] - - -class Settings(BaseSettings): - admin_ui: bool = Field(default=True, env="LNBITS_ADMIN_UI") - # users - admin_users: List[str] = Field(default_factory=list, env="LNBITS_ADMIN_USERS") - allowed_users: List[str] = Field(default_factory=list, env="LNBITS_ALLOWED_USERS") - admin_ext: List[str] = Field(default_factory=list, env="LNBITS_ADMIN_EXTENSIONS") - disabled_ext: List[str] = Field( - default_factory=list, env="LNBITS_DISABLED_EXTENSIONS" - ) - funding_source: str = Field(default="VoidWallet", env="LNBITS_BACKEND_WALLET_CLASS") - # ops - data_folder: str = Field(default=None, env="LNBITS_DATA_FOLDER") - database_url: str = Field(default=None, env="LNBITS_DATABASE_URL") - force_https: bool = Field(default=True, env="LNBITS_FORCE_HTTPS") - reserve_fee_min: int = Field(default=4000, env="LNBITS_RESERVE_FEE_MIN") - reserve_fee_pct: float = Field(default=1.0, env="LNBITS_RESERVE_FEE_PERCENT") - service_fee: float = Field(default=0, env="LNBITS_SERVICE_FEE") - hide_api: bool = Field(default=False, env="LNBITS_HIDE_API") - denomination: str = Field(default="sats", env="LNBITS_DENOMINATION") - # Change theme - site_title: str = Field(default="LNbits", env="LNBITS_SITE_TITLE") - site_tagline: str = Field( - default="free and open-source lightning wallet", env="LNBITS_SITE_TAGLINE" - ) - site_description: str = Field(default=None, env="LNBITS_SITE_DESCRIPTION") - default_wallet_name: str = Field( - default="LNbits wallet", env="LNBITS_DEFAULT_WALLET_NAME" - ) - theme: List[str] = Field(default_factory=list, env="LNBITS_THEME_OPTIONS") - custom_logo: str = Field(default=None, env="LNBITS_CUSTOM_LOGO") - ad_space: List[str] = Field(default_factory=list, env="LNBITS_AD_SPACE") - # .env - env: Optional[str] - debug: Optional[str] - host: Optional[str] - port: Optional[str] - lnbits_path: Optional[str] = path.dirname(path.realpath(__file__)) - - # @validator('admin_users', 'allowed_users', 'admin_ext', 'disabled_ext', pre=True) - # def validate(cls, val): - # print(val) - # return val.split(',') - - class Config: - env_file = ".env" - env_file_encoding = "utf-8" - case_sensitive = False - json_loads = list_parse_fallback - - -conf = Settings() -WALLET = wallet_class()