mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 06:48:02 +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 []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
# todo: remove
|
||||||
readonly_variables = [
|
readonly_variables = [
|
||||||
"host",
|
"host",
|
||||||
"port",
|
"port",
|
||||||
|
@ -43,6 +44,7 @@ class LNbitsSetings(BaseSettings):
|
||||||
if type(val) == str:
|
if type(val) == str:
|
||||||
val = val.split(",") if val else []
|
val = val.split(",") if val else []
|
||||||
return val
|
return val
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
env_file = ".env"
|
env_file = ".env"
|
||||||
env_file_encoding = "utf-8"
|
env_file_encoding = "utf-8"
|
||||||
|
@ -170,12 +172,13 @@ class ReadOnlySettings(LNbitsSetings):
|
||||||
"LnTipsWallet",
|
"LnTipsWallet",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
# @validator(
|
|
||||||
# "lnbits_allowed_funding_sources",
|
@validator(
|
||||||
# pre=True,
|
"lnbits_allowed_funding_sources",
|
||||||
# )
|
pre=True,
|
||||||
# def validate(cls, val):
|
)
|
||||||
# return super().validate(cls, val)
|
def validate_readonly_settings(cls, val):
|
||||||
|
return super().validate(cls, val)
|
||||||
|
|
||||||
|
|
||||||
class Settings(EditableSetings, ReadOnlySettings):
|
class Settings(EditableSetings, ReadOnlySettings):
|
||||||
|
@ -194,7 +197,6 @@ class AdminSettings(EditableSetings):
|
||||||
lnbits_allowed_funding_sources: Optional[List[str]]
|
lnbits_allowed_funding_sources: Optional[List[str]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
settings.lnbits_path = str(path.dirname(path.realpath(__file__)))
|
settings.lnbits_path = str(path.dirname(path.realpath(__file__)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue