Learn how to set up and use config profiles in a project to streamline building and testing apps.
*-hsmeta.json
configuration files in the project. When running hs project upload
or hs project dev
, you’ll specify the profile you want to use, and HubSpot will apply variable values accordingly.
This can allow you to streamline building and testing without impacting the production version of your app and without having to manually update configuration values based on your testing environment. For example, you can set up profiles for development and production to handle switching auth redirect URL domains (see example usage).
npm install -g @hubspot/cli@latest
. If you haven’t installed the HubSpot CLI yet, you can run npm install -g @hubspot/cli
.hs project profile add
in your project directory, then follow the terminal prompts to assign the profile a name and a target HubSpot account. It’s highly recommended to use a different account for each profile.
You can also provide the profile name as an argument when running the command, as shown below with an example profile named prod
.
hs account auth
.src
directory as a hsprofile.*.json
file, which has the following schema:
Field | Type | Description |
---|---|---|
accountId | Integer | The ID of the HubSpot account to target when using the profile. |
variables | Object | An object containing key-value pairs for each variable and its assigned value for the profile. You’ll reference these variables in your *-hsmeta.json files using ${VARIABLE_NAME} syntax. |
hs project profile add
command again will include an option to copy the variables from an existing profile into the new one.
To delete a profile, run the hs project profile delete
command. To completely disable profiles for a project, delete all profile files and variables from your configuration files.
hs project profile --help
to view more information
about the available profile commands.*-hsmeta.json
files using the format ${VARIABLE_NAME}
. For example, the app-hsmeta.json
file below is configured to append the VAR
variable value to the app name when uploaded using that profile.
hs project upload
or hs project dev
by including the --profile
or -p
flag. The CLI will then use the account specified by the profile and apply the profile’s variable values. The code block below demonstrates this usage with an example profile named qa
.
upload
or dev
command. The CLI will return an error if no profile is specified.
app-hsmeta.json
), include a ${DOMAIN}
variable in the redirectUrls
field.hsprofile.*.json
):qa
) via the --profile
or -p
flag in the hs project upload
or hs project dev
command.http://test-env-domain.com/oauth-callback
.
prod
) when running hs project upload
.http://production-domain.com/oauth-callback
.