npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hlambda-cli

v0.0.13

Published

CLI for hlambda server.

Downloads

8

Readme

hlambda-cli npm version

hlambda-cli - CLI tool for managing Hlambda server.

NPM

🧰 Install Hlambda CLI

$ npm install -g hlambda-cli

This 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

$ hl

You can get the snippet for running Hlambda docker image directly from the CLI

$ hl snippets docker

Example 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:latest

You 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 test

change working directory to test

$ cd test

Change 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 export

or you can apply the changes by running

$ hlambda metadata apply

or run the hlambda metadata apply with option --admin-secret <your_secret> which is a prefered option to do this action instead of saving secret it in config.yaml

$ 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-reload

to do it manually you can run:

$ hlambda metadata reload

Clearing 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 dev

this 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 dev

to add custom_name environemnt use

$ hl env add custom_name

to delete environment named "staging"

$ hl env delete staging

this will remove the whole environment folder.