# Using zrok sdk without installing zrok and running enable cmd

**URL:** <https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328>\
**Category:** sdk-golang\
**Created:** [October 26, 2024, 12:47pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328 "2024-10-26T12:47:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![c4model](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@c4model](https://openziti.discourse.group/u/c4model)\
**Post date:** [October 26, 2024, 12:47pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/1 "2024-10-26T12:47:51Z")

</div>

I am using the zrok sdk.to create an app, to reduce the support I want to start the app without installing zrok and run the zrok enable command?

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [October 26, 2024, 1:14pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/2 "2024-10-26T13:14:41Z")

</div>

Hi @c4model, welcome to the community and to zrok (and OpenZiti/BrowZer)!

Exciting! What SDK are you using? I'd expect there to be a corresponding `enable` function that you could run but I'm not intimate with these sdks so maybe it's not there yet. Let us know what SDK you're using and we'll try to help.

---

<div class="post-metadata">

**Author:** ![c4model](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@c4model](https://openziti.discourse.group/u/c4model)\
**Post date:** [October 26, 2024, 1:27pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/3 "2024-10-26T13:27:09Z")

</div>

Hi @TheLumberjack, I am trying to use the golang sdk.

I first need to get the root environment `root, err := environment.LoadRoot()` before I can start a .NewListener to create an endpoint.

Can I skip the LoadRoot and pass in the auth token directly into the .NewListener?

---

<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:** [October 26, 2024, 1:53pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/4 "2024-10-26T13:53:07Z")

</div>

Hey...

No, you can't currently skip the `LoadRoot` call as there is a Ziti identity involved in addition to the account token.

There is currently a backlog item to add the `enable` capability to the SDK directly:

> <https://github.com/openziti/zrok/issues/510>
>
> Add a declarative function that enables the zrok env unless already enabled and …returns the enabled root context.
> 
> This is the Go SDK counterpart to the Py SDK feature: https://github.com/openziti/zrok/issues/509

However, in the meantime, if you're feeling adventurous, you could look at what the `zrok enable` command does and use the same calls directly in your code (assuming you're using golang). The same calls will be put behind a facade in the SDK when the above issue is implemented.

---

<div class="post-metadata">

**Author:** ![c4model](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@c4model](https://openziti.discourse.group/u/c4model)\
**Post date:** [October 26, 2024, 2:06pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/5 "2024-10-26T14:06:59Z")

</div>

Hi @michael.quigley, right now the if I use sdk, I need to first install zrok and run the zrok enable command, right?

I will take a look on the `zrok enable` command does.

---

<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:** [October 26, 2024, 2:08pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/6 "2024-10-26T14:08:06Z")

</div>

No. Not at all. If you borrow the code from the `zrok enable` command:

> <https://github.com/openziti/zrok/blob/3cf98fc04fbe1a63632192edc40a75d2d36362b7/cmd/zrok/enable.go#L44>

...you will be able to do everything in your application without installing the `zrok` command.

---

<div class="post-metadata">

**Author:** ![c4model](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@c4model](https://openziti.discourse.group/u/c4model)\
**Post date:** [October 26, 2024, 2:10pm UTC](https://openziti.discourse.group/t/using-zrok-sdk-without-installing-zrok-and-running-enable-cmd/3328/7 "2024-10-26T14:10:05Z")

</div>

Thanks for the info @michael.quigley
