[REFACTOR] .super_user move it into data dir (#1900)
related to https://github.com/lnbits/lnbits/pull/1855 put the `.super_user` into our data_dir to not pollute our root dir removed the weird mention to the url in the logs and mention the `lnbits-cli superuser` instead this is a breaking change for the bundlers, `cat .super_user` is not good anymore. fix would be `cat data/.super_user` but for future compatibility i recommend using `poetry run lnbits-cli superuser`
This commit is contained in:
+15
-2
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
from loguru import logger
|
||||
@@ -20,11 +21,22 @@ def command_group():
|
||||
"""
|
||||
|
||||
|
||||
def get_super_user() -> str:
|
||||
"""Get the superuser"""
|
||||
with open(Path(settings.lnbits_data_folder) / ".super_user", "r") as file:
|
||||
return file.readline()
|
||||
|
||||
|
||||
@click.command("superuser")
|
||||
def superuser():
|
||||
"""Prints the superuser"""
|
||||
with open(".super_user", "r") as file:
|
||||
print(f"http://{settings.host}:{settings.port}/wallet?usr={file.readline()}")
|
||||
click.echo(get_super_user())
|
||||
|
||||
|
||||
@click.command("superuser-url")
|
||||
def superuser_url():
|
||||
"""Prints the superuser"""
|
||||
click.echo(f"http://{settings.host}:{settings.port}/wallet?usr={get_super_user()}")
|
||||
|
||||
|
||||
@click.command("delete-settings")
|
||||
@@ -101,6 +113,7 @@ async def load_disabled_extension_list() -> None:
|
||||
def main():
|
||||
"""main function"""
|
||||
command_group.add_command(superuser)
|
||||
command_group.add_command(superuser_url)
|
||||
command_group.add_command(delete_settings)
|
||||
command_group.add_command(database_migrate)
|
||||
command_group.add_command(database_versions)
|
||||
|
||||
Reference in New Issue
Block a user