Demo Configuration

Objective


  1. Learn how to create the configuration 



Scenario


  1. create a script that imports all the needed configuration
  2. create the nginx configuration



Script


In the main page you've already cloned the repository soajs.petstore.config. In this repository, you will find two folders, import and nginx. In addition, you will find 2 files config.json and package.json.

The import folder contains the provision of the catalogs, environments, pets database, products and tenants. When you run the script the database will get updated with the needed collections and entries.

For the catalogs, Dev Nginx recipe and Dev service recipe are added. These recipes will let you deploy dev environment and any service in dev environment.

For the environments, dev environment is added to the environments ready to be deployed.

For the products, a new product named petStore is added used to give different access levels to the widget and UI modules.

For the tenants, a new tenant is added containing the service configuration used in the widget and UI modules.

For the database, a new database with initial records is added to mongo.



Nginx Configuration


The folder nginx contains one file named site.conf. This file is added to the nginx configuration, so the widget becomes accessible.

In the other end, config.json file contains the path to the above folder. 

This procedure is working because of the Dev Nginx recipe containing the following properties:

  • SOAJS_CONFIG_REPO_PROVIDER: it points to the Git provider of the repository where the nginx configuration file is located.

  • SOAJS_CONFIG_REPO_DOMAIN: it points to the domain of the repository where the nginx configuration file is located.

  • SOAJS_CONFIG_REPO_OWNER: it points to the owner of the repository where the nginx configuration file is located.

  • SOAJS_CONFIG_REPO_BRANCH: it points to the branch of the repository where the nginx configuration is located.

  • SOAJS_CONFIG_REPO_NAMEit points to the name of the repository where the nginx configuration is located.


When these properties are found in a recipe, we will go to the repository and search for a file named config.json. This file will guide us to the nginx folder that contains site.conf file that will be added to the nginx configuration.