Skip to content

Commit

Permalink
fix(SPV-XXX): set callback host while running start.sh + default doma…
Browse files Browse the repository at this point in the history
…in to be different than localhost (#605)

* fix(SPV-XXX): filling callback host with something else than localhost

* fix(SPV-XXX): add example.com as callback host in example config
  • Loading branch information
wregulski authored Jun 3, 2024
1 parent 5a1b9e0 commit 1e4c028
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ nodes:
# deployment id used annotating api calls in XDeployment-ID header - this value will be randomly generated if not set
_deployment_id: spv-wallet-deployment-id
callback:
callback_host: https://xyz.com
callback_host: https://example.com
# token to authenticate callback calls - default callback token will be generated from the Admin Key
_callback_token: 44a82509
# protocol - arc/mapi (arc is default)
Expand Down
2 changes: 1 addition & 1 deletion config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func getCacheDefaults() *CacheConfig {

func getCallbackDefaults() *CallbackConfig {
return &CallbackConfig{
CallbackHost: "http://localhost:3003",
CallbackHost: "https://example.com",
CallbackToken: "",
}
}
Expand Down
14 changes: 14 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ if [ "$load_config" == "true" ]; then
load_from 'SPVWALLET_ADMIN_XPRIV' admin_xpriv
load_from 'RUN_ADMIN_PANEL' admin_panel
done < ".env.config"

if [ -n "$paymail_domain" ]; then
SPVWALLET_NODES_CALLBACK_CALLBACK_HOST="https://$paymail_domain"
print_debug "SPVWALLET_NODES_CALLBACK_CALLBACK_HOST set to $SPVWALLET_NODES_CALLBACK_CALLBACK_HOST"
fi

print_success "Config loaded from .env.config file"
print_debug "Config after loading .env.config:"
print_state
Expand Down Expand Up @@ -474,6 +480,12 @@ if [ "$background" == "" ]; then
print_debug "background: $background"
fi

# Set SPVWALLET_NODES_CALLBACK_CALLBACK_HOST if paymail_domain is set
if [ -n "$paymail_domain" ]; then
SPVWALLET_NODES_CALLBACK_CALLBACK_HOST="https://$paymail_domain"
print_debug "SPVWALLET_NODES_CALLBACK_CALLBACK_HOST set to $SPVWALLET_NODES_CALLBACK_CALLBACK_HOST"
fi

# === SAVE CONFIG ===
print_debug "Config before storing:"
print_state
Expand All @@ -493,6 +505,8 @@ save_to 'RUN_IN_BACKGROUND' background
save_to 'RUN_WITH_DEFAULT_XPUB' default_xpub
save_to 'SPVWALLET_AUTH_ADMIN_KEY' admin_xpub
save_to 'SPVWALLET_ADMIN_XPRIV' admin_xpriv
save_to 'SPVWALLET_NODES_CALLBACK_CALLBACK_HOST' SPVWALLET_NODES_CALLBACK_CALLBACK_HOST

if [ "$admin_panel" == "true" ] && [ "$default_xpub" == "true" ]; then
{
echo "# Use the following xPriv to login to the admin panel:" >> ".env.config"
Expand Down

0 comments on commit 1e4c028

Please sign in to comment.