Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set --disable-json-api with environment variable #4154

Merged
merged 5 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ boilerplate = { version = "1.0.0", features = ["axum"] }
brotli = "7.0.0"
chrono = { version = "0.4.19", features = ["serde"] }
ciborium = "0.2.1"
clap = { version = "4.4.2", features = ["derive"] }
clap = { version = "4.4.2", features = ["derive", "env"] }
colored = "2.0.4"
ctrlc = { version = "3.2.1", features = ["termination"] }
dirs = "5.0.0"
Expand Down
3 changes: 1 addition & 2 deletions deploy/ord.service
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ ExecStart=/usr/local/bin/ord \
--acme-contact mailto:[email protected] \
--csp-origin https://${CSP_ORIGIN} \
--http \
--https \
--disable-json-api
--https
Group=ord
LimitNOFILE=65536
MemoryDenyWriteExecute=true
Expand Down
16 changes: 12 additions & 4 deletions deploy/setup
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,17 @@ mkdir -p \
/etc/systemd/system/bitcoind.service.d \
/etc/systemd/system/ord.service.d

printf "[Service]\nEnvironment=CHAIN=%s\nEnvironment=CSP_ORIGIN=%s\n" $CHAIN $CSP_ORIGIN \
| tee /etc/systemd/system/bitcoind.service.d/override.conf \
> /etc/systemd/system/ord.service.d/override.conf
OVERRIDE=/etc/systemd/system/ord.service.d/override.conf

echo '[Service]' > $OVERRIDE
echo "Environment=CHAIN=$CHAIN" >> $OVERRIDE
echo "Environment=CSP_ORIGIN=$CSP_ORIGIN" >> $OVERRIDE

if [[ $CHAIN == main ]]; then
echo Environment=ORD_SERVER_DISABLE_JSON_API=true >> $OVERRIDE
fi

cp $OVERRIDE /etc/systemd/system/bitcoind.service.d/override.conf

sed -i -E 's/#?PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sshd -t
Expand All @@ -89,7 +97,7 @@ fi

bitcoind --version

chown bitcoin:bitcoin /var/lib/bitcoind/settings.json
rm -f /var/lib/bitcoind/settings.json

if [[ ! -e ~/.cargo/env ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
Expand Down
2 changes: 1 addition & 1 deletion src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub struct Server {
help = "Decompress encoded content. Currently only supports brotli. Be careful using this on production instances. A decompressed inscription may be arbitrarily large, making decompression a DoS vector."
)]
pub(crate) decompress: bool,
#[arg(long, help = "Disable JSON API.")]
#[arg(long, env = "ORD_SERVER_DISABLE_JSON_API", help = "Disable JSON API.")]
pub(crate) disable_json_api: bool,
#[arg(
long,
Expand Down
Loading