Skip to content

Commit

Permalink
feat: use env variables for more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ivynya committed Dec 27, 2023
1 parent e03cd05 commit 5878bd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 6 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ import (

// global environment variables
var (
auth = os.Getenv("AUTH")
identifier = os.Getenv("IDENTIFIER")
auth = os.Getenv("AUTH")
identifier = os.Getenv("IDENTIFIER")
illm_scheme = os.Getenv("ILLM_SCHEME")
illm_host = os.Getenv("ILLM_HOST")
illm_path = os.Getenv("ILLM_PATH")
)

func main() {
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)

// authorize to an illm relay as a provider
u := url.URL{Scheme: "wss", Host: "io.ivy.direct", Path: "/aura/provider"}
u := url.URL{Scheme: illm_scheme, Host: illm_host, Path: illm_path}
c, _, err := websocket.DefaultDialer.Dial(u.String(), http.Header{
"Authorization": []string{"Basic " + auth},
})
Expand Down
8 changes: 7 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"log"
"os"

"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/basicauth"
Expand All @@ -12,14 +13,19 @@ import (
gonanoid "github.com/matoous/go-nanoid/v2"
)

var (
username = os.Getenv("USERNAME")
password = os.Getenv("PASSWORD")
)

func main() {
clients := make(map[string]*websocket.Conn)
providers := make(map[string]*websocket.Conn)

app := fiber.New()
app.Use(basicauth.New(basicauth.Config{
Users: map[string]string{
"ivy-aura-admin": "GmW6Xd8vhUhK3XkARh4Z",
username: password,
},
}))

Expand Down

0 comments on commit 5878bd0

Please sign in to comment.