Switching Between Environments

I currently use two zrok environments - one at api.zrok.io and one on my self-hosted zrok service. To "switch" from a self-hosted environment to a one at api.zrok.io, I need to do something like,

zrok disable
zrok config set apiEndpoint https://api.zrok.io
zrok enable <token>

Is there a better way to interact with multiple environments?

If you're on Linux, you can use a HOME environment variable...

# main environment
$ zrok enable <token> 

# another environment
$ HOME=/tmp/another zrok enable <token>

and then you can do things like:

$ HOME=/tmp/another zrok share public ...
1 Like

I am on Linux, so was able to do the following,

alias zrok-private 'HOME=~/.config/zrok/private zrok'
alias zrok-public 'HOME=~/.config/zrok/public zrok'

and then

> zrok-public enable <token>
> zrok-public overview # ✔️

> zrok-private config set apiEndpoint <endpoint>
> zrok-private enable <token>
> zrok-private overview # ✔️

which resulted in

❯ tree -a ~/.config/zrok
├── private
│   └── .zrok
│       ├── config.json
│       ├── environment.json
│       ├── identities
│       │   └── environment.json
│       └── metadata.json
└── public
    └── .zrok
        ├── environment.json
        ├── identities
        │   └── environment.json
        └── metadata.json


1 Like

I like your use of aliases better than the symlink method I've been using. Will adopt!

1 Like