-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Viewing of Disabled Params (#902)
* Allow Viewing of Disabled Params Resolves #3583 Add a new subcommand "algorand-indexer api-config" to show current config * Mod file * PR comments * PR comments
- Loading branch information
1 parent
8d85bf4
commit 8b58e4b
Showing
7 changed files
with
214 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/algorand/indexer/api" | ||
"github.com/algorand/indexer/api/generated/v2" | ||
"github.com/algorand/indexer/config" | ||
) | ||
|
||
var ( | ||
showAllDisabled bool | ||
) | ||
|
||
var apiConfigCmd = &cobra.Command{ | ||
Use: "api-config", | ||
Short: "dump api configuration", | ||
Long: "dump api configuration", | ||
//Args: | ||
Run: func(cmd *cobra.Command, args []string) { | ||
var err error | ||
config.BindFlags(cmd) | ||
err = configureLogger() | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "failed to configure logger: %v", err) | ||
os.Exit(1) | ||
} | ||
swag, err := generated.GetSwagger() | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "failed to get swagger: %v", err) | ||
os.Exit(1) | ||
} | ||
|
||
options := makeOptions() | ||
|
||
var displayDisabledMapConfig *api.DisplayDisabledMap | ||
// Show a limited subset | ||
if !showAllDisabled { | ||
displayDisabledMapConfig = api.MakeDisplayDisabledMapFromConfig(swag, options.DisabledMapConfig, true) | ||
} else { | ||
displayDisabledMapConfig = api.MakeDisplayDisabledMapFromConfig(swag, options.DisabledMapConfig, false) | ||
} | ||
|
||
output, err := displayDisabledMapConfig.String() | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "failed to output yaml: %v", err) | ||
os.Exit(1) | ||
} | ||
|
||
fmt.Fprint(os.Stdout, output) | ||
os.Exit(0) | ||
|
||
}, | ||
} | ||
|
||
func init() { | ||
apiConfigCmd.Flags().BoolVar(&showAllDisabled, "all", false, "show all api config parameters, enabled and disabled") | ||
} |
This file contains 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
This file contains 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
This file contains 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