# Switching Between Environments

**URL:** <https://openziti.discourse.group/t/switching-between-environments/2785>\
**Category:** zrok\
**Created:** [June 27, 2024, 2:07am UTC](https://openziti.discourse.group/t/switching-between-environments/2785 "2024-06-27T02:07:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanadelbert](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/stefanadelbert/32/2121_2.png) [@stefanadelbert](https://openziti.discourse.group/u/stefanadelbert)\
**Post date:** [June 27, 2024, 2:07am UTC](https://openziti.discourse.group/t/switching-between-environments/2785/1 "2024-06-27T02:07:24Z")

</div>

I currently use two zrok environments - one at [api.zrok.io](http://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](http://api.zrok.io), I need to do something like,

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

```

Is there a better way to interact with multiple environments?

---

<div class="post-metadata">

**Author:** ![michael.quigley](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/michael.quigley/32/1123_2.png) [@michael.quigley](https://openziti.discourse.group/u/michael.quigley)\
**Post date:** [June 27, 2024, 2:48am UTC](https://openziti.discourse.group/t/switching-between-environments/2785/2 "2024-06-27T02:48:06Z")

</div>

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

```auto
# main environment
$ zrok enable <token> 

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

```

and then you can do things like:

```auto
$ HOME=/tmp/another zrok share public ...

```

---

<div class="post-metadata">

**Author:** ![stefanadelbert](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/stefanadelbert/32/2121_2.png) [@stefanadelbert](https://openziti.discourse.group/u/stefanadelbert)\
**Post date:** [June 27, 2024, 4:31am UTC](https://openziti.discourse.group/t/switching-between-environments/2785/3 "2024-06-27T04:31:28Z")

</div>

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

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

```

and then

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

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

```

which resulted in

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

```

👏

---

<div class="post-metadata">

**Author:** ![qrkourier](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/qrkourier/32/52_2.png) [@qrkourier](https://openziti.discourse.group/u/qrkourier)\
**Post date:** [June 27, 2024, 1:03pm UTC](https://openziti.discourse.group/t/switching-between-environments/2785/4 "2024-06-27T13:03:42Z")

</div>

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