mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-23 22:47:05 +01:00
feat: enable validator for ReadonlySettings
This commit is contained in:
parent
7952a462e3
commit
68b4a20e26
1 changed files with 9 additions and 7 deletions
|
@ -21,6 +21,7 @@ def list_parse_fallback(v):
|
|||
return []
|
||||
|
||||
|
||||
# todo: remove
|
||||
readonly_variables = [
|
||||
"host",
|
||||
"port",
|
||||
|
@ -43,6 +44,7 @@ class LNbitsSetings(BaseSettings):
|
|||
if type(val) == str:
|
||||
val = val.split(",") if val else []
|
||||
return val
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
|
@ -170,12 +172,13 @@ class ReadOnlySettings(LNbitsSetings):
|
|||
"LnTipsWallet",
|
||||
]
|
||||
)
|
||||
# @validator(
|
||||
# "lnbits_allowed_funding_sources",
|
||||
# pre=True,
|
||||
# )
|
||||
# def validate(cls, val):
|
||||
# return super().validate(cls, val)
|
||||
|
||||
@validator(
|
||||
"lnbits_allowed_funding_sources",
|
||||
pre=True,
|
||||
)
|
||||
def validate_readonly_settings(cls, val):
|
||||
return super().validate(cls, val)
|
||||
|
||||
|
||||
class Settings(EditableSetings, ReadOnlySettings):
|
||||
|
@ -194,7 +197,6 @@ class AdminSettings(EditableSetings):
|
|||
lnbits_allowed_funding_sources: Optional[List[str]]
|
||||
|
||||
|
||||
|
||||
settings = Settings()
|
||||
|
||||
settings.lnbits_path = str(path.dirname(path.realpath(__file__)))
|
||||
|
|
Loading…
Add table
Reference in a new issue