FAB Settings

The settings part of you FAB config is used to provide both production and non-production settings that are injected by your FAB runtime. For example:

// fab.config.json5
{
  // plugins, deploy, etc.
  settings: {
    production: {
      API_URL: 'https://api.example.com/graphql',
      DEFAULT_LANG: 'en-GB',
      _SECRET_KEY: 'abcd1234',
    },
    staging: {
      API_URL: 'https://staging.example.com/graphql',
    },
  },
}

When deploying, the production environment is the default, but you can invoke the other environments using fab serve:

fab serve fab.zip
fab serve --env=staging fab.zip

Each non-production environment acts as an override to production, so in the case of --env=staging above, you will get the following result:

<head>
  <!-- ... -->
  <script>
    window.FAB_SETTINGS = {
      API_URL: 'https://staging.example.com/graphql',
      DEFAULT_LANG: 'en-GB',
    }
  </script>
</head>
<body>
  <!-- ... -->
</body>