@terrafirmagreg-team/data 1.2.4 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/env.ts +7 -0
- package/src/lib/index.ts +1 -1
package/package.json
CHANGED
package/src/lib/env.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export const env = (key: string): string | undefined =>
|
|
2
2
|
process.env[key]?.trim() || undefined;
|
|
3
3
|
|
|
4
|
+
export type FeatureMode = 'dev' | 'prod' | 'off';
|
|
5
|
+
|
|
6
|
+
export function featureMode(name: string): FeatureMode {
|
|
7
|
+
const raw = env(`${name}_MODE`)?.toLowerCase();
|
|
8
|
+
return raw === 'dev' || raw === 'prod' ? raw : 'off';
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
export function dumpStorageBase(): string | undefined {
|
|
5
12
|
const raw = process.env.NEXT_PUBLIC_DUMP_STORAGE_URL?.trim();
|
|
6
13
|
return raw ? raw.replace(/\/+$/, '') : undefined;
|
package/src/lib/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { env } from './env';
|
|
1
|
+
export { env, featureMode, type FeatureMode } from './env';
|
|
2
2
|
export { d1Binding, type D1Binding } from './d1';
|
|
3
3
|
export { dataDb, dbOrm, dbSql, dbKysely, AppDB, type AppDbClient, type DataOrm } from './db';
|
|
4
4
|
export { githubAppToken } from './app-token';
|