# Configuring simple server example

**URL:** <https://openziti.discourse.group/t/configuring-simple-server-example/477>\
**Category:** Zitifications\
**Created:** [May 9, 2022, 10:53am UTC](https://openziti.discourse.group/t/configuring-simple-server-example/477 "2022-05-09T10:53:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [May 9, 2022, 10:53am UTC](https://openziti.discourse.group/t/configuring-simple-server-example/477/1 "2022-05-09T10:53:49Z")

</div>

I am working through getting this example to work.. but not sure how to troubleshoot.

> <https://github.com/openziti/sdk-golang/blob/main/example/simple-server/simple-server.go>

After I compile the application, I run it using the following command

> ./simple-server -c /Users/houst/.zssh/zssh.json -s golanghttp

Is this correct?

> This is the error I receive.

Error binding service failed to initialize context: (unable to configure ziti as config environment variable ZITI\_SDK\_CONFIG not populated)

[github.com/openziti/sdk-golang/ziti.(\*contextImpl).ListenWithOptions](http://github.com/openziti/sdk-golang/ziti.(*contextImpl).ListenWithOptions)

/Users/houst/go/pkg/mod/github.com/openziti/sdk-golang@v0.16.56/ziti/ziti.go:584

main.withZiti

/Users/houst/DevTech/zitiapps/sdk-golang/example/simple-server/simple-server.go:66

runtime.goexit

/usr/local/go/src/runtime/asm\_amd64.s:1571

panic: failed to initialize context: (unable to configure ziti as config environment variable ZITI\_SDK\_CONFIG not populated)

goroutine 19 [running]:

main.withZiti({0x7ff7bfeff9d0, 0x2})

/Users/houst/DevTech/zitiapps/sdk-golang/example/simple-server/simple-server.go:69 +0x1ad

created by main.main

/Users/houst/DevTech/zitiapps/sdk-golang/example/simple-server/simple-server.go:86 +0x145

---

<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:** [May 9, 2022, 12:36pm UTC](https://openziti.discourse.group/t/configuring-simple-server-example/477/2 "2022-05-09T12:36:37Z")

</div>

> [@markamind](#):
>
> > ./simple-server -c /Users/houst/.zssh/zssh.json -s golanghttp

You need to read that code and follow it along. It's not expecting an argument to be passed that indicates the identity nor does it support flags (the `-c` and `-s` you supplied). Not all samples are uniform. This one expects you to set an environment variable named `ZITI_SDK_CONFIG` which represents the path to the json file.

This should work:

```plaintext
export ZITI_SDK_CONFIG=/Users/houst/.zssh/zssh.json
./simple-server golanghttp

```

---

<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:** [May 9, 2022, 12:37pm UTC](https://openziti.discourse.group/t/configuring-simple-server-example/477/3 "2022-05-09T12:37:45Z")

</div>

addendum: ZITI\_SDK\_CONFIG processing will be buried down in the golang-sdk. If the file isn’t supplied to NewContext, the sdk will look for that env variable and use the value as the path to the identity

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [May 9, 2022, 6:42pm UTC](https://openziti.discourse.group/t/configuring-simple-server-example/477/4 "2022-05-09T18:42:41Z")

</div>

Awesome… this makes a lot of sense now…
