dev@locazia: fix circular import

This commit is contained in:
user 2024-03-01 23:14:38 +03:00
parent 4a51efed01
commit 23ed777400
3 changed files with 7 additions and 5 deletions

View File

@ -12,8 +12,6 @@ if not os.path.exists(UPLOADS_DIR):
os.makedirs(UPLOADS_DIR) os.makedirs(UPLOADS_DIR)
CONFIG_FILE = os.getenv('CONFIG_FILE') or f"{UPLOADS_DIR}/../config" CONFIG_FILE = os.getenv('CONFIG_FILE') or f"{UPLOADS_DIR}/../config"
from app.core.models._config import ConfigFile
config_manager = ConfigFile(CONFIG_FILE)
TELEGRAM_API_KEY = os.environ.get('TELEGRAM_API_KEY') TELEGRAM_API_KEY = os.environ.get('TELEGRAM_API_KEY')
assert TELEGRAM_API_KEY, "Telegram API_KEY required" assert TELEGRAM_API_KEY, "Telegram API_KEY required"

View File

@ -1,5 +1,5 @@
from nacl.bindings import crypto_sign_seed_keypair from nacl.bindings import crypto_sign_seed_keypair
from app.core._config import config_manager from app.core.active_config import active_config
from app.core.logger import make_log from app.core.logger import make_log
from app.core._blockchain.ton.wallet_v3cr3 import WalletV3CR3 from app.core._blockchain.ton.wallet_v3cr3 import WalletV3CR3
from os import urandom, getenv from os import urandom, getenv
@ -7,11 +7,11 @@ from tonsdk.utils import Address
def load_hot_pair(): def load_hot_pair():
hot_seed = config_manager.get('private_key') hot_seed = active_config.get('private_key')
if hot_seed is None: if hot_seed is None:
make_log("HotWallet", "No seed found, generating new one", level='info') make_log("HotWallet", "No seed found, generating new one", level='info')
hot_seed = urandom(32).hex() hot_seed = urandom(32).hex()
config_manager.set('private_key', hot_seed) active_config.set('private_key', hot_seed)
return load_hot_pair() return load_hot_pair()
public_key, private_key = crypto_sign_seed_keypair(bytes.fromhex(hot_seed)) public_key, private_key = crypto_sign_seed_keypair(bytes.fromhex(hot_seed))

View File

@ -0,0 +1,4 @@
from app.core.models._config import ConfigFile
from app.core._config import CONFIG_FILE
active_config = ConfigFile(CONFIG_FILE)