Package Exports
- hlambda-cli
- hlambda-cli/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hlambda-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
hlambda-cli 
hlambda-cli - CLI tool for managing Hlambda server.
๐งฐ Install Hlambda CLI
$ npm install -g hlambda-cliThis will add Hlambda CLI to your arsenal, now you can use hl, hla or hlambda.
๐ Using Hlambda CLI
Check if the console is installed globally, in your terminal you can now run
$ hlYou can get the snippet for running Hlambda docker image directly from the CLI
$ hl snippets dockerExample output:
docker run -d -p 8081:1331 --env HLAMBDA_ADMIN_SECRET=demo --name hlambda-server --restart=always -v hlambda_metadata:/usr/src/app/metadata hlambda/hlambda-core:latestYou can even run it directly via additional flag --run
$ hl snip docker --run๐ง๐ปโโ๏ธ Quich start
Initialize new configuration in the new folder test
$ hl i testchange working directory to test
$ cd testChange the admin_secret in the config.yaml manually or just run
$ hlambda config save --admin-secret "demo"this will edit the config.yaml file and save admin secret value in that file (๐งจ please take extra care when commiting config.yaml file to not leak secrets
, check Environments section for more details but we suggest you to use env replacer syntax like {{ENV_HLAMBDA_ADMIN_SECRET}} and keeping your secrets in the environemnt variables)
You can then export the existing metadata from the running server use
$ hlambda metadata exportor you can apply the changes by running
$ hlambda metadata applyor run the hlambda metadata apply with option --admin-secret
$ hlambda metadata apply --admin-secret <your_secret>to export existing data from the hlambda server run
$ hlambda metadata export --admin-secret <your_secret>Reloading metadata
By default metadata apply should also automatically reload the metadata on the server unless --no-auto-reload option is set
$ hlambda metadata apply --no-auto-reloadto do it manually you can run:
$ hlambda metadata reloadClearing metadata
If you want to clear all the metadata from the server
$ hlambda metadata clear๐ฆ Environments
If you have multiple deployments of the same app you can now add environments to your hlambda config using hlambda-cli
To add dev environment use
$ hl env add devthis will add new dev folder environment in ./environments/dev with config.yaml
example content of the ./environments/dev/config.yaml
version: 1
endpoint: "{{ENV_DEV_HLAMBDA_ENDPOINT}}"
admin_secret: "{{ENV_DEV_HLAMBDA_ADMIN_SECRET}}"this will be used instead of the values in root config.yaml file.
๐งจ Important! - You can hardcode but it is the best practice to use env replacer syntax {{ENV_DEV_HLAMBDA_ADMIN_SECRET}} the value will be the one provided in the ENV_DEV_HLAMBDA_ADMIN_SECRET environment variable at the CLI command run-time.
โจ Hlambda cli also supports .env file ๐
so you can create .env file in the root
ENV_DEV_HLAMBDA_ENDPOINT="http://localhost:8081"
ENV_DEV_HLAMBDA_ADMIN_SECRET="demo"Any hlambda CLI command can now be excuted for different environment, example
$ hl server logs --env dev$ hl metadata apply --env devto add custom_name environemnt use
$ hl env add custom_nameto delete environment named "staging"
$ hl env delete stagingthis will remove the whole environment folder.
