Contents

Configuration

Chaplin reads its configuration from a chaplin_config.json file at the root of you chaplin project. For testing purposes, the examples given here point to localhost, but any url can be used You can also use env variables to set the api url.

Scenario: Using a YAML configuration

  • Given I have the following app.yml file
    api_url: http://localhost:1234
    
    routes:
      GET /profile: "user_info.html"
    
    pages:
      user_info.html:
        user_data: "GET /user"
  • Then Chaplin connects to the api on port 1234

Scenario: Using a YAML configuration

  • Given I have the following app.yml file
    api_url: "http://localhost:{{env.PORT}}"
    
    routes:
      GET /profile: "user_info.html"
    
    pages:
      user_info.html:
        user_data: "GET /user"
  • And I set the environment variable PORT to 1234
  • Then Chaplin connects to the api on port 1234

Scenario: Using a json configuration

  • Given I have the following app.json file
    json
    {
      "routes": {
        "GET /profile": "user_info.html"
      },
    
      "pages": {
        "user_info.html":  { "user_data": ["GET /user"]  }
      },
    
      "api_url": "http://localhost:1234"
    }
  • Then Chaplin connects to the api on port 1234

Source: features/configuration.feature at commit fe1da3d7, Chaplin (MIT license).