All the entries you store in Vect can be labeled using our robust labeling engine. Labeling can be used to give Vect more context about you configurations and parameters entries and allow you to simply browse through them.

Untitled

There are two main building blocks for the Labels definitions

Labels Rules

Label rules are used to label entries (files, keys, or directories) as their contextual meaning (such as FeatureFlag, Env (prod, staging dev), Tenants.

Labels rules manage the labels that are applied to each file, either: directly (on it), inheritance (on parent dir), or by a rule (such as regex)

Label rules are defined in the .vect/labels directory in Vect, and can be also Viewed in the Labels Panel:

Untitled

To add a new Label rule, you can add the to the .vect/labels/rules.json file a new object with the following property:

Lets go over a few examples of the Label rules:

{
    "labelName": "environment",
    "entryPath": "development", // will label every file under development directory
}

{
    "labelName": "funds",
    "entryPath": "*/funds.json" // will label all files that match funds.json
}

We can also use Label rules to label specific keys within a JSON file, consider the following ad-service.json configuration file:

{
    "tenants":
    [
        {
            "name": "acme corp",
						...
        },
				{
						"name": "warner ltd",
						...
				}
    ]
}

We can create the Label tenants that contains acme corp and warner ltd using the following label rule:

{
    "labelName": "ad-service-tenant",
    "entryPath": "*/ad-service.json['tenants'][*]['name']"
}

Label Properties

Label properties are used to let Vect know what to do with the entires, such as how to present them, what validations to run on it, and what hooks it should trigger.