Remote Config Templates and Versioning


Remote Config templates are sets of JSON-formatted parameters and conditions that you have created for your Firebase project. You can create client templates, from which your app fetches values, and server templates, from which server clients can fetch values.

This section discusses server templates. To learn about client-specific templates, click Client templates.

You modify and manage the template using the Firebase console, which displays the contents of the template in graphical format in the Parameters and Conditions tabs.

Here's an example of a server template file:

{
  "parameters": {
    "preamble_prompt": {
      "defaultValue": {
        "value": "You are a helpful assistant who knows everything there is to know about Firebase! "
      },
      "description": "Add this prompt to the user's prompt",
      "valueType": "STRING"
    },
    "model_name": {
      "defaultValue": {
        "value": "gemini-pro-test"
      },
      "valueType": "STRING"
    },
    "generation_config": {
      "defaultValue": {
        "value": "{\"temperature\": 0.9, \"maxOutputTokens\": 2048, \"topP\": 0.9, \"topK\": 20}"
      },
      "valueType": "JSON"
    },
  },
  "version": {
    "versionNumber": "19",
    "isLegacy": true
  }
}

You can perform these version management tasks with the Firebase console:

  • List all stored template versions
  • Retrieve a specific version
  • Roll back to a specific client version
  • Delete Remote Config templates from the Change history page

There is a total limit of 300 lifetime stored versions per template type (300 client templates and 300 server templates), which includes stored version numbers for deleted templates. If you publish more than 300 template versions per template type during the lifetime of a project, the earliest versions are deleted, maintaining a maximum of 300 versions of that type.

Each time you update parameters, Remote Config creates a new versioned Remote Config template and stores the previous template as a version that you can retrieve or roll back to as needed. Version numbers are incremented sequentially from the initial value stored by Remote Config. All templates include a version field as shown, containing metadata about that specific version.

You can delete Remote Config templates as-needed from the Change history page on the Remote Config console.

Manage Remote Config template versions

This section describes how to manage versions of your Remote Config template.

List all stored versions of the Remote Config template

You can retrieve a list of all stored versions of the Remote Config template. To do this:

  1. From the Firebase console, open Remote Config.

  2. Then, from the Parameters tab, select the "clock" icon displayed at top right.

    This opens the Change history page listing all stored template versions in a list menu at the right.

    The list of templates includes metadata for all stored versions, including the time of the update, the user who made it, and how it was made.

Retrieve a specific version of the Remote Config template

You can retrieve any specific stored version of the Remote Config template. To retrieve a stored template version:

  1. Open the details pane of Change history.

  2. To view details for another version in the list, select it from the right menu.

  3. View a detailed diff of the active template and any other stored version by hovering over the context menu for any non-selected version and selecting Compare with selected version.

Roll back to a specific stored version of the Remote Config template

You can roll back to any stored version of the template. To roll back a template:

  1. Locate the option button at the top right of the Change history page. Click and confirm this only if you are sure you want to roll back to that version and use those values immediately for all apps and users.

Note that this rollback operation effectively creates a new numbered version. For example, rolling back from version 10 to version 6 effectively creates a new copy of version 6, differing from the original only in that its version number is 11. The original version 6 is still stored, assuming it has not reached its expiration, and version 11 becomes the active template.

Delete a Remote Config template

You can delete Remote Config templates from the Firebase console. To delete a Remote Config template:

1. From the Remote Config Parameters page, click Change history.
  1. Toggle to the template you want to delete, click More, then select Delete.

  2. When prompted to confirm the deletion, click Delete.

Download and publish Remote Config templates

Download and publish Remote Config templates to integrate them into your source control and build systems, automate config updates, and keep parameters and values in sync across multiple projects.

You can download the currently active Remote Config template from the Firebase console. You can then update the exported JSON file and publish it to the same project, or publish it to a new or existing project.

Let's say you have multiple projects that represent different stages of your software development lifecycle, like development, test, staging, and production environments. In this case, you could promote a fully-tested template from your staging environment to your production environment by downloading it from your staging project and publishing it to your production project.

You can also use this method to migrate configurations from one project to another, or populate a new project with parameters and values from an established project.

Parameters and parameter values created specifically as variants in an A/B Testing experiment are not included in exported templates.

To export and import Remote Config templates:

  1. Download the current Remote Config Config template.
  2. Validate the Remote Config template.
  3. Publish the Remote Config template.

Download the current Remote Config Template

Use the following to download the active Remote Config template in JSON format:

  1. From the Remote Config Parameters or Conditions tab, open the Menu, and select Download current config file.
  2. When prompted, click Download config file, choose the location where you want to save the file, then click Save.

Validate the Remote Config template

Server templates are validated when you attempt to publish from the Firebase console. Note that User in Random Percentage conditions can be imported, but any unsupported condition will generate an error during upload. If you're attempting to publish a template that was originally exported from a client template, be sure to remove any client-specific conditions first.

Publish the Remote Config template

After downloading a template, making any needed changes to the JSON content, and validating it, you can publish it to a project.

Publishing a template replaces the entire existing config template with the updated file and increments the template version by one. Because the entire configuration is replaced, if you delete a parameter from the JSON file and publish it, the parameter is deleted from the server and is no longer available to clients.

After publishing, changes to parameters and values are immediately available to your apps and users. If necessary, you can roll back to a previous version.

Use the following commands to publish your template:

  1. From the Remote Config Parameters or Conditions tab, open the Menu, and select Publish from a file.
  2. When prompted, click Browse, navigate to and select the Remote Config file you want to publish, then click Select.
  3. The file will be validated and, if successful, you can click Publish to make the configuration immediately available to your apps and users.

Next steps