Skip to content

Commit

Permalink
Merge 149f1ae into 9cc19c4
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion authored Jul 6, 2021
2 parents 9cc19c4 + 149f1ae commit f7c9495
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/cli/src/options/beaconNodeOptions/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {defaultOptions, IBeaconNodeOptions, allNamespaces} from "@chainsafe/lodestar";
import {ICliCommandOptions} from "../../util";

const enabledAll = "*";

export interface IApiArgs {
"api.rest.api": string[];
"api.rest.cors": string;
Expand All @@ -24,12 +26,16 @@ export function parseArgs(args: IApiArgs): IBeaconNodeOptions["api"] {
export const options: ICliCommandOptions<IApiArgs> = {
"api.rest.api": {
type: "array",
choices: allNamespaces,
description: "Pick namespaces to expose for HTTP API",
choices: [...allNamespaces, enabledAll],
description: `Pick namespaces to expose for HTTP API. Set to '${enabledAll}' to enable all namespaces`,
defaultDescription: JSON.stringify(defaultOptions.api.rest.api),
group: "api",
// Parse ["debug,lodestar"] to ["debug", "lodestar"]
coerce: (namespaces: string[]): string[] => namespaces.map((val) => val.split(",")).flat(1),
coerce: (namespaces: string[]): string[] => {
// Enable all
if (namespaces.includes(enabledAll)) return allNamespaces;
// Parse ["debug,lodestar"] to ["debug", "lodestar"]
return namespaces.map((val) => val.split(",")).flat(1);
},
},

"api.rest.cors": {
Expand Down

0 comments on commit f7c9495

Please sign in to comment.