Full local environment documentation
-
yarn install
to install dependencies -
npx hs init
if you haven’t already done so to create a config filehubspot.config.yml
-
npx hs auth
to authenticate Hubspot environment, for local development use 'Finanzchef24 Local' - copy
env.example.env
to.env
and set required environment variables in.env
file -
npx hs project upload
to upload changes orhs project dev
to develop locally
Hubspot has it's own way of secret management for serverless functions, please see (documentation)[https://developers.hubspot.com/docs/platform/serverless-functions#managing-secrets] for more information. For local development you can use .env file. To see list of secrets run hs secrets list
NOTE: To release locally follow steps in 'Local Setup'
To release to stage
and production
environment in Hubspot we need to:
- set environment variable in CircleCI.
- set secrets in Hubspot
The hs
binary at the moment has only 'interactive' process where it opens a browser for the user to copy accesskey
and there are no way to run it in not interactive way to provide accesskey directly to the command line in CI environment. That's why we store the whole file as an environment variable.
Steps
- if you have any
hubspot.config.yml
in root folder of the package, rename it tohubspot.config.yml.local
, so we make sure there is nohubspot.config.yml
- run
npx hs init
and follow the process for Hubspot environemet - now you have
hubspot.config.yml
- convert it to base64
cat hubspot.config.yml | base64 -w 0
- copy the value into an environment variable
HUBSPOT_EXTENSION_CONFIG_STAGE
for stage orHUBSPOT_EXTENSION_CONFIG_PRODUCTION
for production in CircleCI - make sure all secrets listed in
serverless.json
are set, seehs secrets --help
for more information - remove
hubspot.config.yml
- rename
hubspot.config.yml.local
tohubspot.config.yml