adds airtable configs

This commit is contained in:
nai-degen
2023-05-25 15:30:18 -05:00
parent 2a4675a139
commit 54eff150d3
+18 -5
View File
@@ -8,7 +8,6 @@ const startupLogger = pino({ level: "debug" }).child({ module: "startup" });
const isDev = process.env.NODE_ENV !== "production";
type PromptLoggingBackend = "google_sheets";
export type DequeueMode = "fair" | "random" | "none";
type Config = {
@@ -75,12 +74,22 @@ type Config = {
logLevel?: "debug" | "info" | "warn" | "error";
/** Whether prompts and responses should be logged to persistent storage. */
promptLogging?: boolean;
/** Which prompt logging backend to use. */
promptLoggingBackend?: PromptLoggingBackend;
/** Which prompt logging backend to use.
*
* `google_sheets`: Logs prompts and responses to a Google Sheets spreadsheet.
* This method is no longer recommended; see docs for more info.
*
* `airtable`: Logs prompts and responses to an Airtable table.
*/
promptLoggingBackend?: "google_sheets" | "airtable";
/** Base64-encoded Google Sheets API key. */
googleSheetsKey?: string;
/** Google Sheets spreadsheet ID. */
googleSheetsSpreadsheetId?: string;
/** Airtable API key. */
airtableKey?: string;
/** Airtable base ID. */
airtableBaseId?: string;
/** Whether to periodically check keys for usage and validity. */
checkKeys?: boolean;
/**
@@ -234,7 +243,7 @@ export async function assertConfigIsValid() {
// Ensure forks which add new secret-like config keys don't unwittingly expose
// them to users.
for (const key of getKeys(config)) {
const maybeSensitive = ["key", "credentials", "secret", "password"].some(
const maybeSensitive = ["key", "credential", "secret", "password"].some(
(sensitive) => key.toLowerCase().includes(sensitive)
);
const secured = new Set([...SENSITIVE_KEYS, ...OMITTED_KEYS]);
@@ -251,7 +260,10 @@ export async function assertConfigIsValid() {
* Config keys that are masked on the info page, but not hidden as their
* presence may be relevant to the user due to privacy implications.
*/
export const SENSITIVE_KEYS: (keyof Config)[] = ["googleSheetsSpreadsheetId"];
export const SENSITIVE_KEYS: (keyof Config)[] = [
"googleSheetsSpreadsheetId",
"airtableBaseId",
];
/**
* Config keys that are not displayed on the info page at all, generally because
@@ -267,6 +279,7 @@ export const OMITTED_KEYS: (keyof Config)[] = [
"checkKeys",
"quotaDisplayMode",
"googleSheetsKey",
"airtableKey",
"firebaseKey",
"firebaseRtdbUrl",
"gatekeeperStore",