Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #743 from yordis/yordis/feat-add-env-var-for-webso…
Browse files Browse the repository at this point in the history
…cket-host

yordis/feat add env var for websocket host
  • Loading branch information
connorsmith256 authored Aug 30, 2023
2 parents 7085c24 + 98e93b3 commit 6ddc6fd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/washboard/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_NATS_WEBSOCKET_URL=ws://localhost:4001
11 changes: 11 additions & 0 deletions packages/washboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Washboard

## References

### Environment Variables

Please read more about [Env Variables and Modes][0].

- `VITE_NATS_WEBSOCKET_URL` - Default NATS websocket URL.

[0]: https://vitejs.dev/guide/env-and-mode.html
2 changes: 1 addition & 1 deletion packages/washboard/src/lattice/lattice-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class LatticeService {
private connection?: NatsConnection;

private config = {
latticeUrl: 'ws://localhost:4001',
latticeUrl: import.meta.env.VITE_NATS_WEBSOCKET_URL || 'ws://localhost:4001',
};

private constructor() {
Expand Down
8 changes: 8 additions & 0 deletions packages/washboard/src/vite.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />

interface ImportMetaEnv {
readonly VITE_NATS_WEBSOCKET_URL: string
}

interface ImportMeta {
readonly env: ImportMetaEnv
}

0 comments on commit 6ddc6fd

Please sign in to comment.