The hubspot local development tooling uses a configuration file to store information about the HubSpot accounts that it has been granted access to.
The config file is named huspot.config.yml.
There are a handful of standard config utils that anyone working in this library should be familiar with.
Locates and parses the hubspot config file. This function will automatically find the correct config file using the following criteria:
- Checks to see if a config was specified via environment variables (see below)
- If no environment variables are present, looks for a global config file (located at
~/.hscli/config.yml) - If no global config file is found, looks up the file tree for a local config file.
- If no local config file is found, throws an error
HUBSPOT_CONFIG_PATH- specify a file path to a specific config fileUSE_ENVIRONMENT_HUBSPOT_CONFIG- load config account from environment variables. The following environment variables are supported:HUBSPOT_PERSONAL_ACCESS_KEYHUBSPOT_ACCOUNT_IDHTTP_TIMEOUTDEFAULT_CMS_PUBLISH_MODE
Safely writes updated values to the HubSpot config file.
Returns config data for a specific account, given the account's ID or name. Errors if an account is not found.
Returns config data for a specific account, given either a name or an ID. Returns null without erroring if an account is not found
Here is an example of a basic HubSpot config file with a single account configured.
defaultPortal: my-hubspot-account
portals:
- name: my-hubspot-account
portalId: 12345
authType: personalaccesskey
auth:
tokenInfo:
accessToken: my-access-token
expiresAt: '2024-02-07T17:10:32.747Z'
accountType: STANDARD
personalAccessKey: 'my-personal-access-key'