Skip to content

Commit

Permalink
fix: wscat mprocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Mar 28, 2024
1 parent 5ddd9f0 commit 58f9ce9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
8 changes: 4 additions & 4 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FEDIMINT_CLIENTD_INVITE_CODE = 'fed1...'
FEDIMINT_CLIENTD_DB_PATH = '/absolute/path/to/fm_db_dir'
FEDIMINT_CLIENTD_PASSWORD = 'some-secure-password-that-becomes-the-bearer-token'
FEDIMINT_CLIENTD_ADDR = '127.0.0.1:3333'
FEDIMINT_CLIENTD_INVITE_CODE='fed1...'
FEDIMINT_CLIENTD_DB_PATH='/absolute/path/to/fm_db_dir'
FEDIMINT_CLIENTD_PASSWORD='some-secure-password-that-becomes-the-bearer-token'
FEDIMINT_CLIENTD_ADDR='127.0.0.1:3333'
3 changes: 2 additions & 1 deletion fedimint-clientd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct Cli {
manual_secret: Option<String>,

/// Mode: ws, rest
#[clap(long, default_value = "rest")]
#[clap(long, env = "FEDIMINT_CLIENTD_MODE", default_value = "rest")]
mode: Mode,
}

Expand Down Expand Up @@ -121,6 +121,7 @@ async fn main() -> Result<()> {
.with_state(state)
.layer(ValidateRequestHeaderLayer::bearer(&cli.password)),
};
info!("Starting server in {:?} mode", cli.mode);

let cors = CorsLayer::new()
// allow `GET` and `POST` when accessing the resource
Expand Down
3 changes: 3 additions & 0 deletions justfile.local.just
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ test-ts:

test-go:
cd wrappers/fedimint-go && go run cmd/main.go

wscat:
mprocs -c mprocs-wscat.yaml
23 changes: 23 additions & 0 deletions mprocs-wscat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
procs:
user:
shell: zsh # if on macOS
# shell: bash # if on Linux
stop: SIGKILL
wscat:
shell: |
export $(cat .env | xargs)
while ! nc -z localhost 3333; do
echo "Waiting for fedimint-clientd to be ready..."
sleep 1
done
echo "fedimint-clientd is up - executing wscat"
wscat -c ws://localhost:3333/ws -H "Authorization: Bearer $FEDIMINT_CLIENTD_PASSWORD"
stop: SIGTERM
fedimint-clientd:
shell: FEDIMINT_CLIENTD_MODE=ws cargo run --manifest-path fedimint-clientd/Cargo.toml
stop: SIGTERM
ngrok:
shell: |
export $(cat .env | xargs)
ngrok http $FEDIMINT_CLIENTD_ADDR
stop: SIGTERM

0 comments on commit 58f9ce9

Please sign in to comment.