make shutdown endpoint default
This commit is contained in:
@ -55,8 +55,8 @@ jobs:
|
||||
~/.cargo/git
|
||||
backend/target
|
||||
key: ${{ runner.os }}-cargo-test-${{ hashFiles('backend/Cargo.lock') }}
|
||||
- name: Build Binary with Shutdown
|
||||
run: cargo build --features shutdown --bin nuchat
|
||||
- name: Build Binary
|
||||
run: cargo build --locked --bin nuchat
|
||||
- name: Run Tests
|
||||
run: ./scripts/test.sh
|
||||
- name: Upload Test Logs
|
||||
|
||||
@ -28,5 +28,6 @@ path = "src/main.rs"
|
||||
name ="nuchat"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = [ "shutdown" ]
|
||||
all = ["shutdown"]
|
||||
shutdown = []
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
build:
|
||||
cargo build --features shutdown
|
||||
cargo build
|
||||
|
||||
run:
|
||||
cargo run --features shutdown
|
||||
cargo run
|
||||
|
||||
start:
|
||||
cargo run --features shutdown 2>&1 > logs/nuchat.log
|
||||
cargo run 2>&1 > logs/nuchat.log
|
||||
|
||||
test:
|
||||
./scripts/test.sh
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
# Backend
|
||||
|
||||
Generate random secret using. This secret will be used to authenticate users on all `/admin` routes
|
||||
Generate random secret using openssl. This secret will be used to authenticate users on all `/admin` routes.
|
||||
If no secret is given then no authentication will be required
|
||||
|
||||
```bash
|
||||
ADMIN_SECRET=$(openssl rand --base64 32)
|
||||
nuchat --admin-secret $(openssl rand --base64 32)
|
||||
```
|
||||
|
||||
## Features
|
||||
@ -11,5 +12,5 @@ ADMIN_SECRET=$(openssl rand --base64 32)
|
||||
### shutdown
|
||||
this feature enables an endpoint that allows you to shutdown the server.
|
||||
|
||||
**WARNING**: If the `ADMIN_SECRET` env var is not set then this endpoint is completely exposed and allows anyone to shutdown the server.
|
||||
**WARNING**: If the `admin-secret` flag is not set then this endpoint is completely exposed and allows anyone to shutdown the server.
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ fi
|
||||
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
|
||||
|
||||
# start server
|
||||
cargo run --features shutdown -- --port 7001 2>&1 > logs/nuchat.log &
|
||||
cargo run -- --port 7001 2>&1 > logs/nuchat.log &
|
||||
|
||||
# run tests
|
||||
cargo nextest run --color=always 2>&1 | tee logs/test-output.log
|
||||
|
||||
Reference in New Issue
Block a user