Home

Awesome

IO Functions for Services

This project implements the APIs called by the 3rd party services. The implementation is based on the Azure Functions v2 runtime.

Architecture

The project is structured as follows:

Contributing

Setup

Install the Azure Functions Core Tools.

Install the dependencies:

yarn install

Create a file local.settings.json in your cloned repo, with the following contents:

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "WEBSITE_NODE_DEFAULT_VERSION": "10.14.1",
    "AzureWebJobsStorage": "<JOBS_STORAGE_CONNECTION_STRING>",
    "APPINSIGHTS_INSTRUMENTATIONKEY": "<APPINSIGHTS_KEY>",
    "MESSAGE_CONTAINER_NAME": "message-content",
    "COSMOSDB_NAME": "<COSMOSDB_DB_NAME>",
    "COSMOSDB_KEY": "<COSMOSDB_KEY>",
    "COSMOSDB_URI": "<COSMOSDB_URI>",
    "WEBHOOK_CHANNEL_URL": "<WEBHOOK_URL>",
    "MAILUP_USERNAME": "<MAILUP_USERNAME>",
    "MAILUP_SECRET": "<MAILUP_PASSWORD>",
    "MAIL_FROM_DEFAULT": "IO - l’app dei servizi pubblici <no-reply@io.italia.it>",
    "QueueStorageConnection": "<QUEUES_STORAGE_CONNECTION_STRING>",
    "SUBSCRIPTIONS_FEED_TABLE": "SubscriptionsFeedByDay"
  },
  "ConnectionStrings": {}
}

Starting the functions runtime

yarn start

The server should reload automatically when the code changes.

Run Integration Tests locally

To start itegration tests:

cd __integrations__
cp environments/env.base environments/.env
yarn start 
docker exec integrations__-testagent_1 yarn test

To stop docker containers:

cd __integrations__
yarn stop