Skip to content

Commit

Permalink
update generate-config to use HASURA_CONFIGURATION_DIRECTORY
Browse files Browse the repository at this point in the history
  • Loading branch information
TristenHarr committed Apr 17, 2024
1 parent f281a12 commit 3f182af
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# DuckDB Connector Changelog
This changelog documents changes between release tags.

## [0.0.11] - 2024-04-17
* Update generate-config to use the proper configuration directory

## [0.0.10] - 2024-04-17
* Update SDK to 4.5.0
* Update packaging to use a Dockerized Command
Expand Down
4 changes: 2 additions & 2 deletions connector-definition/connector-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
packagingDefinition:
type: PrebuiltDockerImage
dockerImage: ghcr.io/hasura/ndc-duckdb:v0.0.10
dockerImage: ghcr.io/hasura/ndc-duckdb:v0.0.11
supportedEnvironmentVariables:
- name: DUCKDB_URL
description: The url for the DuckDB database
commands:
update:
type: Dockerized
dockerImage: ghcr.io/hasura/ndc-duckdb:v0.0.10
dockerImage: ghcr.io/hasura/ndc-duckdb:v0.0.11
commandArgs:
- update
dockerComposeWatch:
Expand Down
10 changes: 5 additions & 5 deletions generate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import * as fs from 'fs';
import { promisify } from "util";
const writeFile = promisify(fs.writeFile);
const readFile = promisify(fs.readFile);
let HASURA_CONFIGURATION_DIRECTORY = process.env["HASURA_CONFIGURATION_DIRECTORY"] as string | undefined;
if (HASURA_CONFIGURATION_DIRECTORY === undefined || HASURA_CONFIGURATION_DIRECTORY.length === 0){
HASURA_CONFIGURATION_DIRECTORY = ".";
}
const DUCKDB_URL = process.env["DUCKDB_URL"] as string;
const HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH = process.env["HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH"] as string | undefined;
const db = new duckdb.Database(DUCKDB_URL);
const con = db.connect();

Expand Down Expand Up @@ -110,10 +113,7 @@ async function main() {
}
};
const jsonString = JSON.stringify(res, null, 4);
let filePath = `${HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH}/config.json`;
if (HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH === undefined || HASURA_PLUGIN_CONNECTOR_CONTEXT_PATH.length === 0){
filePath = "config.json";
}
let filePath = `${HASURA_CONFIGURATION_DIRECTORY}/config.json`;
try {
const existingData = await readFile(filePath, 'utf8');
if (existingData !== jsonString) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "duckdb-sdk",
"version": "0.0.10",
"version": "0.0.11",
"description": "",
"main": "index.js",
"scripts": {
"start": "DUCKDB_URL=md:?motherduck_token=ey ts-node ./src/index.ts serve --configuration=",
"generate-config": "DUCKDB_URL=md:?motherduck_token=ey ts-node generate-config"
"start": "ts-node ./src/index.ts serve --configuration=",
"generate-config": "ts-node generate-config"
},
"devDependencies": {
"ts-node": "^10.9.1",
Expand Down

0 comments on commit 3f182af

Please sign in to comment.