Skip to content

Commit c79a900

Browse files
committed
fix: resolve compile errors for new config
1 parent af8d8c3 commit c79a900

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

apps/juxt-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "tsup --watch --onSuccess \"node --enable-source-maps dist/server.js\"",
88
"lint": "eslint .",
99
"lint:fix": "eslint . --fix",
10-
"build": "npm run lint && tsup",
10+
"build": "tsup && tsc --noEmit",
1111
"start": "node --enable-source-maps dist/server.js",
1212
"test": "ts-node test/test.ts"
1313
},

apps/juxt-api/src/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const schema = z.object({
77
}).default({}),
88
accountServerAddress: z.string(),
99
aesKey: z.string(),
10-
cdnUrl: z.string().url().transform(s => s.replace(/\/$/, '')),
10+
cdnUrl: z.string().url().transform(s => s.replace(/\/$/g, '')),
1111
mongoose: z.object({
1212
uri: z.string(),
1313
options: z.object({
@@ -28,12 +28,12 @@ const schema = z.object({
2828
friends: z.object({
2929
host: z.string(),
3030
port: z.string(),
31-
api_key: z.string().optional()
31+
apiKey: z.string()
3232
}),
3333
account: z.object({
3434
host: z.string(),
3535
port: z.string(),
36-
api_key: z.string().optional()
36+
apiKey: z.string()
3737
})
3838
})
3939
});

apps/juxt-api/src/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const { mongoose: mongooseConfig } = config;
1919
let connection: mongoose.Connection;
2020

2121
export async function connect(): Promise<void> {
22-
await mongoose.connect(mongooseConfig.connection_string, mongooseConfig.options);
22+
await mongoose.connect(mongooseConfig.uri, mongooseConfig.options);
2323

2424
connection = mongoose.connection;
2525
connection.on('connected', () => {

apps/juxt-api/src/services/api/routes/friend_messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ router.post('/', upload.none(), async function (request: express.Request, respon
196196
is_app_jumpable: request.body.is_app_jumpable,
197197
language_id: request.body.language_id,
198198
mii: sender.mii.data,
199-
mii_face_url: `${config.cdn_url}/mii/${sender.pid}/${miiFace}`,
199+
mii_face_url: `${config.cdnUrl}/mii/${sender.pid}/${miiFace}`,
200200
pid: request.pid,
201201
platform_id: request.paramPack.platform_id,
202202
region_id: request.paramPack.region_id,

apps/juxt-api/src/services/api/routes/posts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ async function newPost(request: express.Request, response: express.Response): Pr
365365
is_app_jumpable: (jumpable) ? 1 : 0,
366366
language_id: languageID,
367367
mii: user.mii.data,
368-
mii_face_url: `${config.cdn_url}/mii/${user.pid}/${miiFace}`,
368+
mii_face_url: `${config.cdnUrl}/mii/${user.pid}/${miiFace}`,
369369
pid: request.pid,
370370
platform_id: platformID,
371371
region_id: regionID,

apps/juxt-api/src/util.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ import type { ParamPack } from '@/types/common/param-pack';
1717
import type { Token } from '@/types/common/token';
1818

1919
// * nice-grpc doesn't export ChannelImplementation so this can't be typed
20-
const gRPCFriendsChannel = createChannel(`${config.grpc.friends.ip}:${config.grpc.friends.port}`);
20+
const gRPCFriendsChannel = createChannel(`${config.grpc.friends.host}:${config.grpc.friends.port}`);
2121
const gRPCFriendsClient = createClient(FriendsDefinition, gRPCFriendsChannel);
2222

23-
const gRPCAccountChannel = createChannel(`${config.grpc.account.ip}:${config.grpc.account.port}`);
23+
const gRPCAccountChannel = createChannel(`${config.grpc.account.host}:${config.grpc.account.port}`);
2424
const gRPCAccountClient = createClient(AccountDefinition, gRPCAccountChannel);
2525

2626
const s3 = new aws.S3({
@@ -80,7 +80,7 @@ export function decryptToken(token: Buffer): Buffer {
8080
const expectedChecksum = token.readUint32BE();
8181
const encryptedBody = token.subarray(4);
8282

83-
const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(config.aes_key, 'hex'), iv);
83+
const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from(config.aesKey, 'hex'), iv);
8484

8585
const decrypted = Buffer.concat([
8686
decipher.update(encryptedBody),
@@ -166,7 +166,7 @@ export async function getUserFriendPIDs(pid: number): Promise<number[]> {
166166
pid: pid
167167
}, {
168168
metadata: Metadata({
169-
'X-API-Key': config.grpc.friends.api_key
169+
'X-API-Key': config.grpc.friends.apiKey
170170
})
171171
});
172172

@@ -178,7 +178,7 @@ export async function getUserFriendRequestsIncoming(pid: number): Promise<Friend
178178
pid: pid
179179
}, {
180180
metadata: Metadata({
181-
'X-API-Key': config.grpc.friends.api_key
181+
'X-API-Key': config.grpc.friends.apiKey
182182
})
183183
});
184184

@@ -190,7 +190,7 @@ export function getUserAccountData(pid: number): Promise<GetUserDataResponse> {
190190
pid: pid
191191
}, {
192192
metadata: Metadata({
193-
'X-API-Key': config.grpc.account.api_key
193+
'X-API-Key': config.grpc.account.apiKey
194194
})
195195
});
196196
}

apps/juxt-api/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"module": "ES2022",
77
"esModuleInterop": true,
88
"moduleResolution": "bundler",
9+
"skipLibCheck": true,
910
"baseUrl": "src",
1011
"outDir": "dist",
1112
"allowJs": true,

0 commit comments

Comments
 (0)