Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/dynamodb-admin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { readFileSync } from 'node:fs';
import { ArgumentParser } from 'argparse';
import open from 'open';
import clc from 'cli-color';
import colors from 'picocolors';
import { createServer } from '../lib/backend';

const { description, version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), { encoding: 'utf8' }));

if (process.env.NODE_ENV === 'production') {
console.error(clc.red('Do not run this in production!'));
console.error(colors.red('Do not run this in production!'));
process.exit(1);
}

Expand Down
12 changes: 6 additions & 6 deletions lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
import clc from 'cli-color';
import colors from 'picocolors';

type CreateAwsConfigOptions = {
dynamoEndpoint?: string;
Expand Down Expand Up @@ -28,21 +28,21 @@ export function createAwsConfig({ dynamoEndpoint, skipDefaultCredentials }: Crea
if (!dynamoEndpoint) {
if (typeof process.env.DYNAMO_ENDPOINT === 'string') {
if (process.env.DYNAMO_ENDPOINT.indexOf('.amazonaws.com') > -1) {
console.error(clc.red('dynamodb-admin is only intended for local development'));
console.error(colors.red('dynamodb-admin is only intended for local development'));
process.exit(1);
}
dynamoConfig.endpoint = process.env.DYNAMO_ENDPOINT;
} else {
console.info(clc.yellow(' DYNAMO_ENDPOINT is not defined (using default of http://localhost:8000)'));
console.info(colors.yellow(' DYNAMO_ENDPOINT is not defined (using default of http://localhost:8000)'));
}
}

console.info(clc.blackBright(` database endpoint: \t${dynamoConfig.endpoint}`));
console.info(colors.blackBright(` database endpoint: \t${dynamoConfig.endpoint}`));
if (dynamoConfig.region) {
console.info(clc.blackBright(` region: \t\t${dynamoConfig.region}`));
console.info(colors.blackBright(` region: \t\t${dynamoConfig.region}`));
}
if (dynamoConfig.credentials && 'accessKeyId' in dynamoConfig.credentials) {
console.info(clc.blackBright(` accessKey: \t\t${dynamoConfig.credentials.accessKeyId}\n`));
console.info(colors.blackBright(` accessKey: \t\t${dynamoConfig.credentials.accessKeyId}\n`));
}

return dynamoConfig;
Expand Down
172 changes: 3 additions & 169 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@
"@aws-sdk/lib-dynamodb": "^3.693.0",
"argparse": "^2.0.1",
"body-parser": "^1.20.3",
"cli-color": "^2.0.4",
"cookie-parser": "^1.4.7",
"ejs": "^3.1.10",
"errorhandler": "^1.5.1",
"express": "^4.21.1",
"lodash.pickby": "^4.6.0",
"open": "^10.1.0"
"open": "^10.1.0",
"picocolors": "^1.1.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-node-resolve": "^15.3.0",
"@rollup/plugin-typescript": "^12.1.1",
"@types/argparse": "^2.0.17",
"@types/cli-color": "^2.0.6",
"@types/cookie-parser": "^1.4.7",
"@types/errorhandler": "^1.5.3",
"@types/express": "^5.0.0",
Expand Down