Example #1
0
def main():
    config.setup_config("MHS")
    secrets.setup_secret_config("MHS")
    log.configure_logging()

    if config.get_config('NO_TLS', default='False') == 'True':
        certificates = certs.Certs()
    else:
        certificates = certs.Certs.create_certs_files(
            definitions.ROOT_DIR,
            private_key=secrets.get_secret_config('CLIENT_KEY'),
            local_cert=secrets.get_secret_config('CLIENT_CERT'),
            ca_certs=secrets.get_secret_config('CA_CERTS'))

    party_key = secrets.get_secret_config('PARTY_KEY')

    workflows = initialise_workflows()
    store = dynamo_persistence_adaptor.DynamoPersistenceAdaptor(
        table_name=config.get_config('STATE_TABLE_NAME'))

    interactions_config_file = pathlib.Path(
        definitions.ROOT_DIR) / 'data' / "interactions" / "interactions.json"
    config_manager = configuration_manager.ConfigurationManager(
        str(interactions_config_file))

    start_inbound_server(certificates.local_cert_path,
                         certificates.ca_certs_path,
                         certificates.private_key_path, party_key, workflows,
                         store, config_manager)
Example #2
0
def main():
    config.setup_config("SDS")
    secrets.setup_secret_config("SDS")
    log.configure_logging('sds')

    sds_client = lookup.sds_client_factory.get_sds_client()
    start_tornado_server(sds_client)
Example #3
0
def main():
    config.setup_config("MHS")
    secrets.setup_secret_config("MHS")
    log.configure_logging('spine-directory-service')

    routing = initialise_routing(search_base=config.get_config("SDS_SEARCH_BASE"))
    start_tornado_server(routing)
def main():
    config.setup_config('SCR')
    secrets.setup_secret_config("SCR")
    log.configure_logging()
    app = build_app()
    app.listen(80)
    tornado.ioloop.IOLoop.current().start()
    def test_get_secret_config_default(self, mock_environ):
        mock_environ["PREFIX_SECRET_TEST"] = "123"

        secrets.setup_secret_config("PREFIX")

        self.assertEqual("111",
                         secrets.get_secret_config("LOG_LEVEL", default="111"))
    def test_setup_secret_config_populates_secret_config(self, mock_environ):
        mock_environ["PREFIX_SECRET_TEST"] = "123"
        mock_environ["PREFIX_SECRET_LOG_LEVEL"] = "INFO"

        self.assertEqual({}, secrets.secret_config)

        secrets.setup_secret_config("PREFIX")

        self.assertEqual({"TEST": "123", "LOG_LEVEL": "INFO"}, secrets.secret_config)
    def test_get_secret_config_success(self, mock_stdout, mock_environ):
        self.setup_logger(mock_environ)

        secret_value = "123547"
        mock_environ["PREFIX_SECRET_TEST"] = secret_value

        secrets.setup_secret_config("PREFIX")

        self.assertEqual(secret_value, secrets.get_secret_config("TEST"))

        output = mock_stdout.getvalue()
        self.assertIn('Obtained secret config', output)
        self.assertNotIn(secret_value, output, msg="Secret value logged when it shouldn't be logged")
Example #8
0
def main():
    config.setup_config("MHS")
    secrets.setup_secret_config("MHS")
    log.configure_logging()
    data_dir = pathlib.Path(definitions.ROOT_DIR) / "data"

    configure_http_client()

    routing = initialise_routing()

    certificates = certs.Certs.create_certs_files(
        data_dir / '..',
        private_key=secrets.get_secret_config('CLIENT_KEY'),
        local_cert=secrets.get_secret_config('CLIENT_CERT'),
        ca_certs=secrets.get_secret_config('CA_CERTS'))
    max_retries = int(
        config.get_config('OUTBOUND_TRANSMISSION_MAX_RETRIES', default="3"))
    retry_delay = int(
        config.get_config('OUTBOUND_TRANSMISSION_RETRY_DELAY', default="100"))
    http_proxy_host = config.get_config('OUTBOUND_HTTP_PROXY', default=None)
    http_proxy_port = None
    if http_proxy_host is not None:
        http_proxy_port = int(
            config.get_config('OUTBOUND_HTTP_PROXY_PORT', default="3128"))
    transmission = outbound_transmission.OutboundTransmission(
        certificates.local_cert_path, certificates.private_key_path,
        certificates.ca_certs_path, max_retries, retry_delay, http_proxy_host,
        http_proxy_port)

    party_key = secrets.get_secret_config('PARTY_KEY')
    work_description_store = dynamo_persistence_adaptor.DynamoPersistenceAdaptor(
        table_name=config.get_config('STATE_TABLE_NAME'))
    sync_async_store = dynamo_persistence_adaptor.DynamoPersistenceAdaptor(
        table_name=config.get_config('SYNC_ASYNC_STATE_TABLE_NAME'))
    store_retries = int(
        config.get_config('STATE_STORE_MAX_RETRIES', default='3'))
    max_request_size = int(config.get_config('SPINE_REQUEST_MAX_SIZE'))
    workflows = initialise_workflows(transmission, party_key,
                                     work_description_store, sync_async_store,
                                     max_request_size, store_retries, routing)
    start_tornado_server(data_dir, workflows)
    def test_setup_secret_config_filters_by_prefix(self, mock_environ):
        mock_environ["SOME_OTHER_SECRET_CONFIG"] = "BLAH"

        secrets.setup_secret_config("PREFIX")

        self.assertEqual({}, secrets.secret_config)