Site Factory

Setting site variables on websites

You can set site variables for each site managed by Site Factory. Site variables can be removed as part of the staging process if they contain sensitive data, such as API keys.

Site variables are available for Site Factory sites according to the following requirements:

  • Each site can have a maximum of 10 site variables defined.
  • Any of the site variable keys must not contain any spaces.

  • Each site variable key can have a maximum length of 25 characters.
  • Each site variable value can have a maximum length of 50 characters.

When managing site variables, review the following expected functionality:

  • Site variables are not copied between sites when a site is duplicated.
  • Selecting the Remove during staging checkbox when defining a site variable removes the site variable from the site when staging it to a lower environment. The production environment is unaffected.
  • After you add a new site variable, the system might take a few minutes to make the site variable available on the site.

Defining a site variable

  1. Sign in to the Site Factory Management Console.
  2. Find the site for which you want to manage site variables.
  3. Click the dropdown arrow next to Login to open the Actions menu for the site.

  4. Click Configure Site Variables.
  5. Use the page controls to add, edit, or remove the site variables for the site.

    After you add a new site variable, the system might take a few minutes to make the site variable available on the site.

Using the site variable in the site code

You can access defined variables within the site code using the following variable:

$GLOBALS['gardens_site_settings']['flags']
```
Example array:
```
array(3) {
   ["external_service_api_key"]=>
   string(13) "apikey-value2"
   ["non-secret-key"]=>
   string(7) "value-2"
   ["external_service_api_key_non-secret"]=>
   string(19) "apikey-value xx1234"
}
```