SchemaSmith Documentation

What Are Script Tokens?

TLDR; Key/Value pairs that allow deferred resolution.

Script Token

Overview

A script token is a key/value pair that you reference using {{..}} delimiters. At runtime, the placeholder is replaced with the corresponding value. This allows you to abstract and defer values until execution time. Script tokens are defined in the ScriptTokens key in product.json and can be used within it and any template.json definition. Additionally, there are two system-defined script tokens documented below.

System Defined Tokens

Token Name Value
ProductNameAutomatically set to your product's name.
TemplateNameSet to the name of the current template being quenched (available only within the template scope).

Example: Defining the token ReleaseVersion in your product.json


{
    "ScriptTokens": {
        "ReleaseVersion": "1.0.0"
    }
}                            

Can be used in a template:


{
  "VersionStampScript": "INSERT ProductVersions(Product, Version) VALUES( '{{ProductName}}', '{{ReleaseVersion}}')"
}
                            

Tip

Product level script tokens can be overridden via appSettings or environment variables.

Additional Resources