From b23c44ddf0b1d9affa1d96778a96b68095c3c1b1 Mon Sep 17 00:00:00 2001 From: Julien Rousseau Date: Tue, 24 Oct 2023 14:31:53 -0400 Subject: [PATCH] removed unused config options --- .env.example | 2 -- README.md | 2 -- src/config.ts | 3 --- src/schemas.spec.ts | 4 ---- src/schemas.ts | 2 -- 5 files changed, 13 deletions(-) diff --git a/.env.example b/.env.example index 3e3d10d..f14d187 100644 --- a/.env.example +++ b/.env.example @@ -11,10 +11,8 @@ HOST=http://127.0.0.1:8123 DATABASE=default USERNAME=default PASSWORD= -CREATE_DB=false # Sink QUEUE_LIMIT=10 QUEUE_CONCURRENCY=10 -SCHEMA_URL=... # generate SQL schema by providing file (ex: ./schema.sql) or URL path (ex: https://example.com/schema.sql) VERBOSE=true \ No newline at end of file diff --git a/README.md b/README.md index fe1cea6..990d699 100644 --- a/README.md +++ b/README.md @@ -73,14 +73,12 @@ Options: -V, --version output the version number -p, --port HTTP port on which to attach the sink (default: "3000", env: PORT) -v, --verbose Enable verbose logging (choices: "true", "false", default: "pretty", env: VERBOSE) - -s, --schema-url Execute SQL instructions before starting the sink (env: SCHEMA_URL) --public-key Public key to validate messages (env: PUBLIC_KEY) --auth-key Auth key to validate requests (env: AUTH_KEY) --host Database HTTP hostname (default: "http://localhost:8123", env: HOST) --database The database to use inside ClickHouse (default: "default", env: DATABASE) --username Database user (default: "default", env: USERNAME) --password Password associated with the specified username (default: "", env: PASSWORD) - --create-database If the specified database does not exist, automatically create it (default: "false", env: CREATE_DATABASE) --async-insert https://clickhouse.com/docs/en/operations/settings/settings#async-insert (choices: "0", "1", default: 1, env: ASYNC_INSERT) --wait-for-insert https://clickhouse.com/docs/en/operations/settings/settings#wait-for-async-insert (choices: "0", "1", default: 0, env: WAIT_FOR_INSERT) --queue-limit Insert delay to each response when the pqueue exceeds this value (default: 10, env: QUEUE_LIMIT) diff --git a/src/config.ts b/src/config.ts index 2fd4f3a..b09139a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,7 +13,6 @@ export const DEFAULT_HOST = "http://localhost:8123"; export const DEFAULT_DATABASE = "default"; export const DEFAULT_USERNAME = "default"; export const DEFAULT_PASSWORD = ""; -export const DEFAULT_CREATE_DATABASE = "false"; export const DEFAULT_ASYNC_INSERT = 1; export const DEFAULT_WAIT_FOR_ASYNC_INSERT = 0; export const DEFAULT_QUEUE_LIMIT = 10; @@ -29,14 +28,12 @@ export const opts = program .addOption(new Option("-p, --port ", "HTTP port on which to attach the sink").env("PORT").default(DEFAULT_PORT)) .addOption(new Option("-v, --verbose ", "Enable verbose logging").choices(["true", "false"]).env("VERBOSE").default(DEFAULT_VERBOSE)) .addOption(new Option("--hostname ", "Server listen on HTTP hostname").env("HOSTNAME").default(DEFAULT_HOSTNAME)) - .addOption(new Option("-s, --schema-url ", "Execute SQL instructions before starting the sink").env("SCHEMA_URL").preset(DEFAULT_SCHEMA_URL)) .addOption(new Option("--public-key ", "Public key to validate messages").env("PUBLIC_KEY")) .addOption(new Option("--auth-key ", "Auth key to validate requests").env("AUTH_KEY")) .addOption(new Option("--host ", "Database HTTP hostname").env("HOST").default(DEFAULT_HOST)) .addOption(new Option("--username ", "Database user").env("USERNAME").default(DEFAULT_USERNAME)) .addOption(new Option("--password ", "Password associated with the specified username").env("PASSWORD").default(DEFAULT_PASSWORD)) .addOption(new Option("--database ", "The database to use inside ClickHouse").env("DATABASE").default(DEFAULT_DATABASE)) - .addOption(new Option("--create-database ", "If the specified database does not exist, automatically create it").env("CREATE_DATABASE").default(DEFAULT_CREATE_DATABASE)) .addOption(new Option("--async-insert ", "https://clickhouse.com/docs/en/operations/settings/settings#async-insert").choices(["0", "1"]).env("ASYNC_INSERT").default(DEFAULT_ASYNC_INSERT)) .addOption(new Option("--wait-for-async-insert ", "https://clickhouse.com/docs/en/operations/settings/settings#wait-for-async-insert").choices(["0", "1"]).env("WAIT_FOR_INSERT").default(DEFAULT_WAIT_FOR_ASYNC_INSERT)) .addOption(new Option("--queue-limit ","Insert delay to each response when the pqueue exceeds this value").env("QUEUE_LIMIT").default(DEFAULT_QUEUE_LIMIT)) diff --git a/src/schemas.spec.ts b/src/schemas.spec.ts index 9a08604..1b9bf7c 100644 --- a/src/schemas.spec.ts +++ b/src/schemas.spec.ts @@ -12,11 +12,9 @@ const config = ConfigSchema.parse({ hostname: "0.0.0.0", publicKey: "a3cb7366ee8ca77225b4d41772e270e4e831d171d1de71d91707c42e7ba82cc9", host: "http://127.0.0.1:8123", - schemaUrl: "./schema.sql", database: "default", username: "default", password: "", - createDb: "false", queueLimit: "10", queueConcurrency: "10", verbose: "true", @@ -30,11 +28,9 @@ describe("ConfigSchema", () => { test("port", () => expect(config.port).toBe(3000)); test("queueLimit", () => expect(config.queueLimit).toBe(10)); test("verbose", () => expect(config.verbose).toBe(true)); - test("schemaUrl", () => expect(config.schemaUrl).toBe("./schema.sql")); test("database", () => expect(config.database).toBe("default")); test("username", () => expect(config.username).toBe("default")); test("publicKey", () => expect(config.publicKey).toBe("a3cb7366ee8ca77225b4d41772e270e4e831d171d1de71d91707c42e7ba82cc9")); test("waitForAsyncInsert", () => expect(config.waitForAsyncInsert).toBe(0)); test("asyncInsert", () => expect(config.asyncInsert).toBe(1)); - test("createDatabase", () => expect(config.createDatabase).toBe(false)); }); diff --git a/src/schemas.ts b/src/schemas.ts index 174aa06..3da789f 100644 --- a/src/schemas.ts +++ b/src/schemas.ts @@ -18,12 +18,10 @@ export const ConfigSchema = z.object({ database: z.string(), username: z.string(), password: z.string(), - createDatabase: boolean, asyncInsert: oneOrZero, waitForAsyncInsert: oneOrZero, queueLimit: positiveNumber, queueConcurrency: positiveNumber, - schemaUrl: z.optional(z.string()), }); export type ConfigSchema = z.infer;