mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add score api url to env var
This commit is contained in:
parent
b7e6888395
commit
69dbbd7635
2 changed files with 11 additions and 6 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import { env } from '../env'
|
||||
|
||||
export interface Feature {
|
||||
library_item_id?: string
|
||||
title: string
|
||||
|
|
@ -29,12 +31,7 @@ export type ScoreApiResponse = Record<string, ScoreBody> // item_id -> score
|
|||
export const getScores = async (
|
||||
data: ScoreApiRequestBody
|
||||
): Promise<ScoreApiResponse> => {
|
||||
const API_URL = 'http://digest-score/batch'
|
||||
// const token = process.env.SCORE_API_TOKEN
|
||||
|
||||
// if (!token) {
|
||||
// throw new Error('No score API token found')
|
||||
// }
|
||||
const API_URL = env.score.apiUrl
|
||||
|
||||
const response = await fetch(API_URL, {
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ export interface BackendEnv {
|
|||
clientSecret: string
|
||||
authUrl: string
|
||||
}
|
||||
score: {
|
||||
apiUrl: string
|
||||
}
|
||||
}
|
||||
|
||||
const nullableEnvVars = [
|
||||
|
|
@ -175,6 +178,7 @@ const nullableEnvVars = [
|
|||
'NOTION_CLIENT_ID',
|
||||
'NOTION_CLIENT_SECRET',
|
||||
'NOTION_AUTH_URL',
|
||||
'SCORE_API_URL',
|
||||
] // Allow some vars to be null/empty
|
||||
|
||||
const envParser =
|
||||
|
|
@ -329,6 +333,9 @@ export function getEnv(): BackendEnv {
|
|||
clientSecret: parse('NOTION_CLIENT_SECRET'),
|
||||
authUrl: parse('NOTION_AUTH_URL'),
|
||||
}
|
||||
const score = {
|
||||
apiUrl: parse('SCORE_API_URL') || 'http://digest-score/batch',
|
||||
}
|
||||
|
||||
return {
|
||||
pg,
|
||||
|
|
@ -352,6 +359,7 @@ export function getEnv(): BackendEnv {
|
|||
subscription,
|
||||
redis,
|
||||
notion,
|
||||
score,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue