# Generating Metadata

Before using a data source in appRules, the metadata must be generated.    Metadata is created when you add a new data source and select the connection associated or when you specifically 'Regenerate Metadata' on the toolbar.

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FjnoCizFgsWqfM7RADDb6%2Fimage.png?alt=media&#x26;token=7fdd4f53-707f-4637-bfa0-eb106df745cd" alt=""><figcaption></figcaption></figure>

To generate metadata, first configure the [connection properties](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings) and click the 'Create Metadata button' or Refresh metadata (when the datasource already exists) to continue.

A Datasource can have different connection associated for each environment (Test, Production...) but the Metadata is unique. If your environnements metadata models are different, define several datasources.

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FCumt2mms4ln0bG2qDK1N%2Fimage.png?alt=media&#x26;token=201384cc-88f0-47cf-811f-8d8811469f54" alt=""><figcaption></figcaption></figure>

The environments are defined in the [RuntimeSettings](https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/runtime-settings) section.
