mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-07-24 23:34:28 +08:00
fix: use string comparison for checking database_less
This commit is contained in:
4
process.d.ts
vendored
4
process.d.ts
vendored
@ -2,10 +2,10 @@ declare namespace NodeJS {
|
||||
export interface ProcessEnv {
|
||||
// Required. Node environment.
|
||||
NODE_ENV: string;
|
||||
// Optional. Set to true to disable the database. Defaults to false.
|
||||
// Optional. Set to "true" to disable the database. Need to use string as env is always string.
|
||||
// We can't prefix DATABASE_URL with NEXT_PUBLIC_ because it contains sensitive information that
|
||||
// should not be exposed to the client.
|
||||
NEXT_PUBLIC_DATABASE_LESS: boolean;
|
||||
NEXT_PUBLIC_DATABASE_LESS: string;
|
||||
// Required if NEXT_PUBLIC_DATABASE_LESS is false. Postgres database connection string to store
|
||||
// the data. e.g. postgresql://postgres:YOUR_PASSWORD@localhost:5432/sqlchat?schema=sqlchat
|
||||
DATABASE_URL: string;
|
||||
|
@ -1,19 +1,23 @@
|
||||
type FeatureType = "debug" | "account" | "payment" | "quota" | "collect";
|
||||
|
||||
function databaseLess() {
|
||||
return process.env.NEXT_PUBLIC_DATABASE_LESS == "true";
|
||||
}
|
||||
|
||||
const matrix: { [key: string]: { [feature: string]: boolean } } = {
|
||||
development: {
|
||||
debug: true,
|
||||
account: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
payment: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
quota: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
collect: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
account: !databaseLess(),
|
||||
payment: !databaseLess(),
|
||||
quota: !databaseLess(),
|
||||
collect: !databaseLess(),
|
||||
},
|
||||
production: {
|
||||
debug: false,
|
||||
account: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
payment: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
quota: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
collect: !process.env.NEXT_PUBLIC_DATABASE_LESS,
|
||||
account: !databaseLess(),
|
||||
payment: !databaseLess(),
|
||||
quota: !databaseLess(),
|
||||
collect: !databaseLess(),
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user