Skip to content

Commit

Permalink
services/horizon: Remove command line flag --remote-captive-core-url (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
urvisavla authored Jul 5, 2023
1 parent 2ec1834 commit 2cc9b7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
1 change: 1 addition & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

- The command line flag --remote-captive-core-url has been removed as remote captive core functionality is now deprecated ([4940](https://github.com/stellar/go/pull/4940)).

## 2.26.0
### Changes
Expand Down
35 changes: 12 additions & 23 deletions services/horizon/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,9 @@ func Flags() (*Config, support.ConfigOptions) {
OptType: types.String,
FlagDefault: "",
Required: false,
Usage: "path to stellar core binary (--remote-captive-core-url has higher precedence). If captive core is enabled, look for the stellar-core binary in $PATH by default.",
Usage: "path to stellar core binary, look for the stellar-core binary in $PATH by default.",
ConfigKey: &config.CaptiveCoreBinaryPath,
},
&support.ConfigOption{
Name: "remote-captive-core-url",
OptType: types.String,
FlagDefault: "",
Required: false,
Usage: "url to access the remote captive core server",
ConfigKey: &config.RemoteCaptiveCoreURL,
},
&support.ConfigOption{
Name: captiveCoreConfigAppendPathName,
OptType: types.String,
Expand Down Expand Up @@ -649,24 +641,21 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption
binaryPath = result
viper.Set(StellarCoreBinaryPathName, binaryPath)
config.CaptiveCoreBinaryPath = binaryPath
} else {
return fmt.Errorf("invalid config: captive core requires --%s. %s",
StellarCoreBinaryPathName, captiveCoreMigrationHint)
}
} else {
config.CaptiveCoreBinaryPath = binaryPath
}

// NOTE: If both of these are set (regardless of user- or PATH-supplied
// defaults for the binary path), the Remote Captive Core URL
// takes precedence.
if binaryPath == "" && config.RemoteCaptiveCoreURL == "" {
return fmt.Errorf("Invalid config: captive core requires that either --%s or --remote-captive-core-url is set. %s",
StellarCoreBinaryPathName, captiveCoreMigrationHint)
}

config.CaptiveCoreTomlParams.CoreBinaryPath = binaryPath
if config.RemoteCaptiveCoreURL == "" && (binaryPath == "" || config.CaptiveCoreConfigPath == "") {
config.CaptiveCoreTomlParams.CoreBinaryPath = config.CaptiveCoreBinaryPath
if config.CaptiveCoreConfigPath == "" {
if options.RequireCaptiveCoreConfig {
var err error
errorMessage := fmt.Errorf(
"Invalid config: captive core requires that both --%s and --%s are set. %s",
StellarCoreBinaryPathName, CaptiveCoreConfigPathName, captiveCoreMigrationHint,
"invalid config: captive core requires that --%s is set. %s",
CaptiveCoreConfigPathName, captiveCoreMigrationHint,
)

var configFileName string
Expand Down Expand Up @@ -707,7 +696,7 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption
return fmt.Errorf("Invalid captive core toml file %v", err)
}
}
} else if config.RemoteCaptiveCoreURL == "" {
} else {
var err error
config.CaptiveCoreTomlParams.HistoryArchiveURLs = config.HistoryArchiveURLs
config.CaptiveCoreTomlParams.NetworkPassphrase = config.NetworkPassphrase
Expand All @@ -719,7 +708,7 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption

// If we don't supply an explicit core URL and we are running a local
// captive core process with the http port enabled, point to it.
if config.StellarCoreURL == "" && config.RemoteCaptiveCoreURL == "" && config.CaptiveCoreToml.HTTPPort != 0 {
if config.StellarCoreURL == "" && config.CaptiveCoreToml.HTTPPort != 0 {
config.StellarCoreURL = fmt.Sprintf("http://localhost:%d", config.CaptiveCoreToml.HTTPPort)
viper.Set(StellarCoreURLFlagName, config.StellarCoreURL)
}
Expand Down

0 comments on commit 2cc9b7e

Please sign in to comment.