mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-05 22:10:10 +00:00
Enable warnings logging to console via envvar
This commit is contained in:
parent
f0cde287e1
commit
6f1e865a15
@ -2,12 +2,12 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import requests
|
import requests, ring, logging
|
||||||
import ring
|
|
||||||
from decouple import config
|
from decouple import config
|
||||||
|
|
||||||
from api.models import Order
|
from api.models import Order
|
||||||
|
|
||||||
|
logger = logging.getLogger('api.utils')
|
||||||
|
|
||||||
def get_tor_session():
|
def get_tor_session():
|
||||||
session = requests.session()
|
session = requests.session()
|
||||||
@ -52,7 +52,8 @@ def validate_onchain_address(address):
|
|||||||
validation = bitcoind_rpc('validateaddress', [address])
|
validation = bitcoind_rpc('validateaddress', [address])
|
||||||
if not validation['isvalid']:
|
if not validation['isvalid']:
|
||||||
return False, {"bad_address": "Invalid address"}
|
return False, {"bad_address": "Invalid address"}
|
||||||
except:
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
return False, {"bad_address": 'Unable to validate address, check bitcoind backend'}
|
return False, {"bad_address": 'Unable to validate address, check bitcoind backend'}
|
||||||
|
|
||||||
return True, None
|
return True, None
|
||||||
|
@ -29,6 +29,7 @@ DEBUG = False
|
|||||||
STATIC_URL = "static/"
|
STATIC_URL = "static/"
|
||||||
STATIC_ROOT = "/usr/src/static/"
|
STATIC_ROOT = "/usr/src/static/"
|
||||||
|
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
if os.environ.get("DEVELOPMENT"):
|
if os.environ.get("DEVELOPMENT"):
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
@ -48,6 +49,28 @@ ALLOWED_HOSTS = [
|
|||||||
# Allows Session Cookie to be read by Javascript on Client side.
|
# Allows Session Cookie to be read by Javascript on Client side.
|
||||||
SESSION_COOKIE_HTTPONLY = False
|
SESSION_COOKIE_HTTPONLY = False
|
||||||
|
|
||||||
|
# Logging settings
|
||||||
|
if os.environ.get("LOG_TO_CONSOLE"):
|
||||||
|
LOGGING = {
|
||||||
|
'version': 1,
|
||||||
|
'disable_existing_loggers': False,
|
||||||
|
'handlers': {
|
||||||
|
'console': {
|
||||||
|
'class': 'logging.StreamHandler',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'root': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'level': 'WARNING',
|
||||||
|
},
|
||||||
|
'loggers': {
|
||||||
|
'api.utils': {
|
||||||
|
'handlers': ['console'],
|
||||||
|
'level': 'WARNING',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
Loading…
Reference in New Issue
Block a user