Skip to content

Commit

Permalink
Amend
Browse files Browse the repository at this point in the history
  • Loading branch information
raphjaph committed Dec 26, 2024
1 parent 6945111 commit eb444ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deploy/ord.service
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ExecStart=/usr/local/bin/ord \
--csp-origin https://${CSP_ORIGIN} \
--http \
--https \
${DISABLE_JSON_API}
${JSON_API}
Group=ord
LimitNOFILE=65536
MemoryDenyWriteExecute=true
Expand Down
12 changes: 6 additions & 6 deletions deploy/setup
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,31 @@ case $CHAIN in
main)
COOKIE_FILE_DIR=/var/lib/bitcoind
CSP_ORIGIN=ordinals.com
DISABLE_JSON_API='--disable-json-api'
JSON_API='--disable-json-api'
ufw allow 8333
;;
regtest)
COOKIE_FILE_DIR=/var/lib/bitcoind/regtest
CSP_ORIGIN=regtest.ordinals.com
DISABLE_JSON_API='--polling-interval=5s'
JSON_API='--enable-json-api'
ufw allow 18444
;;
signet)
COOKIE_FILE_DIR=/var/lib/bitcoind/signet
CSP_ORIGIN=signet.ordinals.com
DISABLE_JSON_API='--polling-interval=5s'
JSON_API='--enable-json-api'
ufw allow 38333
;;
test)
COOKIE_FILE_DIR=/var/lib/bitcoind/testnet3
CSP_ORIGIN=testnet.ordinals.com
DISABLE_JSON_API='--polling-interval=5s'
JSON_API='--enable-json-api'
ufw allow 18333
;;
testnet4)
COOKIE_FILE_DIR=/var/lib/bitcoind/testnet4
CSP_ORIGIN=testnet4.ordinals.com
DISABLE_JSON_API='--polling-interval=5s'
JSON_API='--enable-json-api'
ufw allow 48333
;;
*)
Expand All @@ -78,7 +78,7 @@ mkdir -p \
/etc/systemd/system/bitcoind.service.d \
/etc/systemd/system/ord.service.d

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

Expand Down
18 changes: 16 additions & 2 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,21 @@ 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,
default_value_t = true,
action = clap::ArgAction::SetFalse,
conflicts_with = "disable_json_api",
help = "Enable JSON API (enabled by default)"
)]
pub(crate) enable_json_api: bool,
#[arg(
long,
default_value_t = false,
action = clap::ArgAction::SetTrue,
conflicts_with = "enable_json_api",
help = "Disable JSON API"
)]
pub(crate) disable_json_api: bool,
#[arg(
long,
Expand Down Expand Up @@ -173,7 +187,7 @@ impl Server {
decompress: self.decompress,
domain: acme_domains.first().cloned(),
index_sats: index.has_sat_index(),
json_api_enabled: !self.disable_json_api,
json_api_enabled: self.enable_json_api && !self.disable_json_api,
proxy: self.proxy.clone(),
});

Expand Down

0 comments on commit eb444ed

Please sign in to comment.