Clean up infisical-node

This commit is contained in:
Tuan Dang
2023-03-15 14:03:39 +07:00
parent a6c8638345
commit b868b6a5f3
7 changed files with 70 additions and 30 deletions
+7 -7
View File
@@ -32,7 +32,7 @@
"express-validator": "^6.14.2",
"handlebars": "^4.7.7",
"helmet": "^5.1.1",
"infisical-node": "^1.0.34",
"infisical-node": "^1.0.37",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.0",
"jsrp": "^0.2.4",
@@ -5975,9 +5975,9 @@
}
},
"node_modules/infisical-node": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/infisical-node/-/infisical-node-1.0.34.tgz",
"integrity": "sha512-0joSgkNPZ15aZtm8Mrr/vSWizTYZlJivbawCecfllR4bzQ03TT3Ja4hivYyAmRYkrhUTHqb0gpQ3a8lSk7vyug==",
"version": "1.0.37",
"resolved": "https://registry.npmjs.org/infisical-node/-/infisical-node-1.0.37.tgz",
"integrity": "sha512-9ZswN5UovZq46a7Qv/4KmfaAu9pO/TmxxdcEY2PosDIAlXbpfC651hcKr7T8q1iMlRnHLA/gpYkcZMeS0es0rg==",
"dependencies": {
"axios": "^1.3.3",
"tweetnacl": "^1.0.3",
@@ -16770,9 +16770,9 @@
"dev": true
},
"infisical-node": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/infisical-node/-/infisical-node-1.0.34.tgz",
"integrity": "sha512-0joSgkNPZ15aZtm8Mrr/vSWizTYZlJivbawCecfllR4bzQ03TT3Ja4hivYyAmRYkrhUTHqb0gpQ3a8lSk7vyug==",
"version": "1.0.37",
"resolved": "https://registry.npmjs.org/infisical-node/-/infisical-node-1.0.37.tgz",
"integrity": "sha512-9ZswN5UovZq46a7Qv/4KmfaAu9pO/TmxxdcEY2PosDIAlXbpfC651hcKr7T8q1iMlRnHLA/gpYkcZMeS0es0rg==",
"requires": {
"axios": "^1.3.3",
"tweetnacl": "^1.0.3",
+1 -1
View File
@@ -23,7 +23,7 @@
"express-validator": "^6.14.2",
"handlebars": "^4.7.7",
"helmet": "^5.1.1",
"infisical-node": "^1.0.34",
"infisical-node": "^1.0.37",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.0",
"jsrp": "^0.2.4",
+3 -2
View File
@@ -1,6 +1,6 @@
import infisical from 'infisical-node';
export const getPort = () => infisical.get('PORT')! || 4000;
export const getInviteOnlySignup = () => infisical.get('INVITE_ONLY_SIGNUP')! == undefined ? false : process.env.INVITE_ONLY_SIGNUP;
export const getInviteOnlySignup = () => infisical.get('INVITE_ONLY_SIGNUP')! == undefined ? false : infisical.get('INVITE_ONLY_SIGNUP');
export const getEncryptionKey = () => infisical.get('ENCRYPTION_KEY')!;
export const getSaltRounds = () => parseInt(infisical.get('SALT_ROUNDS')!) || 10;
export const getJwtAuthLifetime = () => infisical.get('JWT_AUTH_LIFETIME')! || '10d';
@@ -46,4 +46,5 @@ export const getStripeProductTeam = () => infisical.get('STRIPE_PRODUCT_TEAM')!;
export const getStripePublishableKey = () => infisical.get('STRIPE_PUBLISHABLE_KEY')!;
export const getStripeSecretKey = () => infisical.get('STRIPE_SECRET_KEY')!;
export const getStripeWebhookSecret = () => infisical.get('STRIPE_WEBHOOK_SECRET')!;
export const getTelemetryEnabled = () => infisical.get('TELEMETRY_ENABLED')! !== 'false' && true;
export const getTelemetryEnabled = () => infisical.get('TELEMETRY_ENABLED')! !== 'false' && true;
export const getLoopsApiKey = () => infisical.get('LOOPS_API_KEY')!;
@@ -8,7 +8,7 @@ import {
import { issueAuthTokens } from '../../helpers/auth';
import { INVITED, ACCEPTED } from '../../variables';
import request from '../../config/request';
import { getNodeEnv } from '../../config';
import { getNodeEnv, getLoopsApiKey } from '../../config';
/**
* Complete setting up user by adding their personal and auth information as part of the
@@ -108,7 +108,7 @@ export const completeAccountSignup = async (req: Request, res: Response) => {
token = tokens.token;
// sending a welcome email to new users
if (process.env.LOOPS_API_KEY) {
if (getLoopsApiKey()) {
await request.post("https://app.loops.so/api/v1/events/send", {
"email": email,
"eventName": "Sign Up",
@@ -117,7 +117,7 @@ export const completeAccountSignup = async (req: Request, res: Response) => {
}, {
headers: {
"Accept": "application/json",
"Authorization": "Bearer " + process.env.LOOPS_API_KEY
"Authorization": "Bearer " + getLoopsApiKey()
},
});
}
+2 -5
View File
@@ -72,11 +72,8 @@ import {
} from './config';
const main = async () => {
// TODO 1: handle case of empty string token
// TODO 2: handle case of undefined token
const client = await infisical.connect({
token: process.env.INFISICAL_TOKEN!,
debug: true
await infisical.connect({
token: process.env.INFISICAL_TOKEN!
});
logTelemetryMessage();