Add --network parameter to prefill parameters with sane defaults per-network#540
Merged
Add --network parameter to prefill parameters with sane defaults per-network#540
--network parameter to prefill parameters with sane defaults per-network#540Conversation
…rks in absence of passphrase/archiveURLs) for pubnet and testnet
Shaptic
reviewed
Nov 20, 2025
Shaptic
approved these changes
Nov 20, 2025
--network parameter to prefill parameters with sane defaults per-network
Contributor
Contributor
|
@urvisavla we need extra flags for diagnostic events 😭 |
Contributor
Author
|
@urvisavla @Shaptic Yeah, @mollykarcher and I talked about this. Mentally have it pointed as a 3-pt issue because it involves 1.) embedding/exporting the common cfg files 2.) then for each of RPC/Horizon/Galexie building some configurer that prepends the necessary alternative flags as bytes to the imported common configs []bytes. Doing that in the reverse order would probably kill all the convenience of this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The PR introduces a new optional
NETWORKconfiguration parameter in RPC, which allows users to specify a preset Stellar network,pubnetortestnet.WhenNETWORKis set, RPC automatically adjusts the relevant parameters in the deployed instance's configuration and generates a corresponding captive core config file. TheNETWORKparameter may be specified through the command line (usage: --network [preset]), the.tomlconfig file, or ENV variables.If the
NETWORKparameter is specified, these fields are automatically populated based on the chosen network:HISTORY_ARCHIVE_URLSNETWORK_PASSPHRASECAPTIVE_CORE_CONFIG_PATH: The default configuration file for pubnet and testnet is embedded in the Horizon binary and used to generate the default configuration.If the
NETWORKparameter isn't specified,HISTORY_ARCHIVE_URLSandNETWORK_PASSPHRASEare both mandatory. An error message is displayed if they're not supplied.If the
NETWORKparameter is specified but is not"pubnet"or"testnet", an error message is displayed.If the
NETWORKparameter is specified and (HISTORY_ARCHIVE_URLSorNETWORK_PASSPHRASE) is supplied, an error message is displayed. This error message is not displayed ifHISTORY_ARCHIVE_URLSandNETWORK_PASSPHRASEexactly match the values theNETWORKparameter would supply.This PR also introduces a test in
main_test.gothat validates this behavior. Specifically, the test will verify that when thenetworkoption is provided, theHISTORY_ARCHIVE_URLSandNETWORK_PASSPHRASEfields are populated with their correct values. Further, it verifies that supplying thenetworkoption withNETWORK_PASSPHRASEerrors.Why
This simplifies the user experience and enables users to rapidly choose a default network configuration without manually configuring
HISTORY_ARCHIVE_URLSorNETWORK_PASSPHRASE. Users also no longer have to manually install a captive core configuration file forpubnetandtestnet.Known limitations
[N/A]