Exemplo n.º 1
0
def get_message_patch_api_endpoint_auth_params():
    if MESSAGE_PATCH_API_ENDPOINT_AUTH == COGNITO_JWT_AUTH:
        # These env variables may change in the future
        jurisdiction = env("IGL_JURISDICTION")
        return {
            "client_id": env_json("IGL_JURISDICTION_OAUTH_CLIENT_ID")[jurisdiction],
            "client_secret": env_json("IGL_JURISDICTION_OAUTH_CLIENT_SECRET")[jurisdiction],
            "scopes": env_json("IGL_JURISDICTION_OAUTH_SCOPES")[jurisdiction],
            "wellknown_url": env_json("IGL_JURISDICTION_OAUTH_WELLKNOWN_URL")[jurisdiction],
        }
Exemplo n.º 2
0
class Config(object):
    """Base configuration."""
    DEBUG = env_bool('IGL_DEBUG', default=True)
    TESTING = env_bool('IGL_TESTING', default=True)

    CHANNEL_NOTIFICATION_REPO_CONF = env_queue_config(
        'CHANNEL_NOTIFICATION_REPO')
    ROUTING_TABLE = env_json("IGL_MCHR_ROUTING_TABLE")

    SENTRY_DSN = env("SENTRY_DSN", default=None)
Exemplo n.º 3
0
def Config():
    environment_config = dict(
        SUBSCRIPTIONS_REPO=env_s3_config('SUBSCRIPTIONS_REPO'),
        # api base url, ex: https://test.api.com
        CHANNEL_URL=env('CHANNEL_URL'),

        TESTING=env_bool('TESTING', default=False),
        DEBUG=env_bool('DEBUG', default=False),

        HTTP_BLOCKCHAIN_ENDPOINT=env('HTTP_BLOCKCHAIN_ENDPOINT'),

        CONTRACT_REPO=env_s3_config('CONTRACT_REPO'),
        CONTRACT_BUILD_ARTIFACT_KEY=env('CONTRACT_BUILD_ARTIFACT_KEY'),
        CONTRACT_NETWORK_ID=str(int(env('CONTRACT_NETWORK_ID', default=1))),
        CONTRACT_OWNER_PRIVATE_KEY=env('CONTRACT_OWNER_PRIVATE_KEY'),

        MESSAGE_CONFIRMATION_THRESHOLD=int(env('CONFIRMATION_THRESHOLD', default='12')),

        SENDER=env('SENDER', default='AU')
    )
    return Box(environment_config)
Exemplo n.º 4
0
def Config():
    environment_config = dict(
        NOTIFICATIONS_REPO=env_queue_config('NOTIFICATIONS_REPO'),
        CHANNEL_REPO=env_queue_config('CHANNEL_REPO'),
        RECEIVER=env('RECEIVER'))
    return Box(environment_config)
Exemplo n.º 5
0
import logging
from logging.config import dictConfig

import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

from libtrustbridge.utils.conf import env_bool, env

SENTRY_DSN = env('SENTRY_DSN')

if SENTRY_DSN:  # pragma: no cover
    sentry_logging = LoggingIntegration(
        level=logging.INFO,  # Capture info and above as breadcrumbs
        event_level=logging.ERROR  # Send errors as events
    )

    sentry_sdk.init(dsn=SENTRY_DSN, integrations=[sentry_logging])

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s[%(name)s] %(message)s'
        }
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose',
Exemplo n.º 6
0
import pytest
from http import HTTPStatus
import urllib
import requests
from src import repos
from libtrustbridge.utils.conf import env_s3_config, env_queue_config, env

NOTIFICATIONS_REPO = env_queue_config('NOTIFICATIONS_REPO')
DELIVERY_OUTBOX_REPO = env_queue_config('DELIVERY_OUTBOX_REPO')
SUBSCRIPTIONS_REPO = env_s3_config('SUBSCRIPTIONS_REPO')
CHANNEL_REPO = env_queue_config('CHANNEL_REPO')
ENDPOINT = env('ENDPOINT', default='AU')


@pytest.fixture(scope='function')
def notifications_repo():
    repo = repos.Notifications(NOTIFICATIONS_REPO)
    repo.WAIT_FOR_MESSAGE_SECONDS = 1
    repo._unsafe_method__clear()
    yield repo


@pytest.fixture(scope='function')
def delivery_outbox_repo():
    repo = repos.DeliveryOutbox(DELIVERY_OUTBOX_REPO)
    repo.WAIT_FOR_MESSAGE_SECONDS = 1
    repo._unsafe_method__clear()
    yield repo


@pytest.fixture(scope='function')
Exemplo n.º 7
0
import hashlib

from libtrustbridge.utils.conf import env, env_json

from intergov.loggers import logging

logger = logging.getLogger(__name__)

MESSAGE_PATCH_API_ENDPOINT = env(
    'IGL_PROC_BCH_MESSAGE_API_ENDPOINT',
    default='http://message_api/message/{sender}:{sender_ref}')

COGNITO_JWT_AUTH = "Cognito/JWT"
MESSAGE_PATCH_API_ENDPOINT_AUTH = env("IGL_PROC_BCH_MESSAGE_API_ENDPOINT_AUTH",
                                      default=COGNITO_JWT_AUTH)

MESSAGE_RX_API_URL = env('IGL_PROC_BCH_MESSAGE_RX_API_URL',
                         default='http://message_rx_api')

COUNTRY = env("IGL_COUNTRY", 'AU')

ROUTING_TABLE = env_json("IGL_MCHR_ROUTING_TABLE", default=[])

for i, rule in enumerate(ROUTING_TABLE):
    if "Id" not in rule:
        logger.warning("Wrong channel configuration: no ID for line %s", i)
        rule["Id"] = hashlib.md5("lala".encode("utf-8")).hexdigest() + str(i)
Exemplo n.º 8
0
def Config():
    environment_config = dict(
        DELIVERY_OUTBOX_REPO=env_queue_config('DELIVERY_OUTBOX_REPO'),
        TOPIC_BASE_SELF_URL=env('TOPIC_BASE_SELF_URL', '/topic'),
        CHANNEL_URL=env('CHANNEL_URL'))
    return Box(environment_config)