Skip to content

Commit

Permalink
Nit changes - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya1702 committed Oct 6, 2023
1 parent b92c673 commit 758bf93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions services/horizon/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,10 @@ func Flags() (*Config, support.ConfigOptions) {

if val := viper.GetString(opt.Name); val != "" {
stdLog.Printf(
"DEPRECATED - No ingestion filter rules are defined by default, which equates to no filtering " +
"of historical data. If you have never added filter rules to this deployment, then nothing further needed. " +
"If you have defined ingestion filter rules prior but disabled filtering overall by setting this flag " +
"disabled with --exp-enable-ingestion-filtering=false, then you should now delete the filter rules using " +
"the Horizon Admin API to achieve the same no-filtering result. Remove usage of this flag in all cases.",
"DEPRECATED - No ingestion filter rules are defined by default, which equates to " +
"no filtering of historical data. If you have never added filter rules to this deployment, then no further action is needed. " +
"If you have defined ingestion filter rules previously but disabled filtering overall by setting the env variable EXP_ENABLE_INGESTION_FILTERING=false, " +
"then you should now delete the filter rules using the Horizon Admin API to achieve the same no-filtering result. Remove usage of this variable in all cases.",
)
}
return nil
Expand Down Expand Up @@ -833,7 +832,7 @@ func setCaptiveCoreConfiguration(config *Config, options ApplyOptions) error {
// ApplyFlags applies the command line flags on the given Config instance
func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOptions) error {
// Check if the user has passed any flags and if so, print a DEPRECATED warning message.
flagsPassedByUser := flags.GetAllFlagsPassedByUser()
flagsPassedByUser := flags.GetCommandLineFlagsPassedByUser()
if len(flagsPassedByUser) > 0 {
result := fmt.Sprintf("DEPRECATED - the use of command-line flags: %s, has been deprecated in favor of environment variables. "+
"Please consult our Configuring section in the developer documentation on how to use them - https://developers.stellar.org/docs/run-api-server/configuring", flagsPassedByUser)
Expand Down
7 changes: 3 additions & 4 deletions services/horizon/internal/integration/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,10 +475,9 @@ func TestDeprecatedOutputs(t *testing.T) {
os.Stderr = originalStderr

assert.Contains(t, string(outputBytes), "DEPRECATED - No ingestion filter rules are defined by default, which equates to "+
"no filtering of historical data. If you have never added filter rules to this deployment, then nothing further needed. "+
"If you have defined ingestion filter rules prior but disabled filtering overall by setting this flag disabled with "+
"--exp-enable-ingestion-filtering=false, then you should now delete the filter rules using the Horizon Admin API to achieve "+
"the same no-filtering result. Remove usage of this flag in all cases.")
"no filtering of historical data. If you have never added filter rules to this deployment, then no further action is needed. "+
"If you have defined ingestion filter rules previously but disabled filtering overall by setting the env variable EXP_ENABLE_INGESTION_FILTERING=false, "+
"then you should now delete the filter rules using the Horizon Admin API to achieve the same no-filtering result. Remove usage of this variable in all cases.")
})
t.Run("deprecated output for command-line flags", func(t *testing.T) {
originalStderr := os.Stderr
Expand Down
3 changes: 2 additions & 1 deletion support/config/config_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func (cos ConfigOptions) SetValues() error {
return nil
}

func (cos ConfigOptions) GetAllFlagsPassedByUser() []string {
// GetCommandLineFlagsPassedByUser returns a list of command-line flags that were passed by the user when running Horizon.
func (cos ConfigOptions) GetCommandLineFlagsPassedByUser() []string {
var flagsPassedByUser []string
for _, co := range cos {
if co.flag.Changed {
Expand Down

0 comments on commit 758bf93

Please sign in to comment.