diff --git a/.env.example b/.env.example index 644a011..d77dd2a 100644 --- a/.env.example +++ b/.env.example @@ -4,10 +4,11 @@ USERNAME=default DATABASE=default PASSWORD= -# Webhook Ed25519 signature (Optional) -PUBLIC_KEYS=... # ed25519 public key provided by https://github.com/pinax-network/substreams-sink-webhook +# Webhook Ed25519 public key (comma separated for multiple) (optional) +# https://github.com/pinax-network/substreams-sink-webhook +PUBLIC_KEY= -# Sink HTTP server (Optional) +# Sink HTTP server (optional) PORT=3000 HOSTNAME=0.0.0.0 VERBOSE=true \ No newline at end of file diff --git a/.env.test b/.env.test deleted file mode 100644 index ee33917..0000000 --- a/.env.test +++ /dev/null @@ -1 +0,0 @@ -PUBLIC_KEY=public-key diff --git a/README.md b/README.md index 63b17b1..fe7d8d6 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Every request can also be executed via the [online UI](http://localhost:3000). 1. Associate Webhook Ed25519 public keys from [substreams-sink-webhook](https://github.com/pinax-network/substreams-sink-webhook). ```bash - $ echo "PUBLIC_KEYS=,,..." >> .env + $ echo "PUBLIC_KEY=,,..." >> .env ``` 1. Initialize the database (_set database credentials in [environment](#environment)_) @@ -78,10 +78,11 @@ USERNAME=default DATABASE=default PASSWORD= -# Webhook Ed25519 signature (Optional) -PUBLIC_KEYS=... # ed25519 public key provided by https://github.com/pinax-network/substreams-sink-webhook +# Webhook Ed25519 public key (comma separated for multiple) (optional) +# https://github.com/pinax-network/substreams-sink-webhook +PUBLIC_KEY= -# Sink HTTP server (Optional) +# Sink HTTP server (optional) PORT=3000 HOSTNAME=0.0.0.0 VERBOSE=true @@ -103,7 +104,7 @@ Options: -v, --verbose Enable verbose logging (choices: "true", "false", default: "true", env: VERBOSE) -p, --port Sink HTTP server port (default: "3000", env: PORT) --hostname Sink HTTP server hostname (default: "0.0.0.0", env: HOSTNAME) - --public-keys Webhook Ed25519 public keys (comma separated) (env: PUBLIC_KEYS) + --public-key Webhook Ed25519 public key (comma separated for multiple) (env: PUBLIC_KEY) --host Clickhouse DB hostname (default: "http://localhost:8123", env: HOST) --username Clickhouse DB username (default: "default", env: USERNAME) --password Clickhouse DB password (default: "", env: PASSWORD) diff --git a/src/config.ts b/src/config.ts index 5c5a737..866c351 100644 --- a/src/config.ts +++ b/src/config.ts @@ -22,8 +22,7 @@ export const opts = program .addOption(new Option("-v, --verbose ", "Enable verbose logging").choices(["true", "false"]).env("VERBOSE").default(DEFAULT_VERBOSE)) .addOption(new Option("-p, --port ", "Sink HTTP server port").env("PORT").default(DEFAULT_PORT)) .addOption(new Option("--hostname ", "Sink HTTP server hostname").env("HOSTNAME").default(DEFAULT_HOSTNAME)) - .addOption(new Option("--public-key ", "Webhook Ed25519 public keys (comma separated)").env("PUBLIC_KEY").hideHelp()) - .addOption(new Option("--public-keys ", "Webhook Ed25519 public keys (comma separated)").env("PUBLIC_KEYS")) + .addOption(new Option("--public-key ", "Webhook Ed25519 public keys (comma separated for multiple)").env("PUBLIC_KEY")) .addOption(new Option("--host ", "Clickhouse DB hostname").env("HOST").default(DEFAULT_HOST)) .addOption(new Option("--username ", "Clickhouse DB username").env("USERNAME").default(DEFAULT_USERNAME)) .addOption(new Option("--password ", "Clickhouse DB password").env("PASSWORD").default(DEFAULT_PASSWORD)) @@ -36,7 +35,7 @@ export const config = ConfigSchema.parse(opts); // validate public key export const publicKeys: string[] = []; -for ( const publicKey of [...config.publicKeys ?? [], ...config.publicKey ?? []] ) { +for ( const publicKey of config.publicKey ?? [] ) { if ( publicKey.length !== 64 ) throw new Error("Invalid Ed25519 public key length"); publicKeys.push(publicKey); } \ No newline at end of file diff --git a/src/schemas.ts b/src/schemas.ts index 82df654..787f524 100644 --- a/src/schemas.ts +++ b/src/schemas.ts @@ -10,7 +10,6 @@ export const splitString = (separator: string ) => z.optional(z.string().transfo export const ConfigSchema = z.object({ publicKey: splitString(","), - publicKeys: splitString(","), port: positiveNumber, verbose: boolean, host: z.string(),