@pixelated-tech/components 3.7.10 → 3.7.11
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.
|
@@ -33,7 +33,7 @@ export const usePixelatedConfig = () => {
|
|
|
33
33
|
}
|
|
34
34
|
// Also return null if config is empty (no environment config loaded)
|
|
35
35
|
if (Object.keys(ctx).length === 0) {
|
|
36
|
-
console.warn('Pixelated config is empty. Check that
|
|
36
|
+
console.warn('Pixelated config is empty. Check that src/app/config/pixelated.config.json is available.');
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
39
|
return ctx;
|
|
@@ -7,23 +7,21 @@ const debug = false;
|
|
|
7
7
|
* This function is intended for server-side use only.
|
|
8
8
|
*/
|
|
9
9
|
export function getFullPixelatedConfig() {
|
|
10
|
-
let raw =
|
|
11
|
-
let source =
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
console.error(`Failed to read config file at ${configPath}`, err);
|
|
22
|
-
}
|
|
10
|
+
let raw = '';
|
|
11
|
+
let source = 'none';
|
|
12
|
+
// Try reading from the conventional file location
|
|
13
|
+
const configPath = path.join(process.cwd(), 'src/app/config/pixelated.config.json');
|
|
14
|
+
if (fs.existsSync(configPath)) {
|
|
15
|
+
try {
|
|
16
|
+
raw = fs.readFileSync(configPath, 'utf8');
|
|
17
|
+
source = 'src/app/config/pixelated.config.json';
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
console.error(`Failed to read config file at ${configPath}`, err);
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
if (!raw) {
|
|
26
|
-
console.error('PIXELATED_CONFIG not found:
|
|
24
|
+
console.error('PIXELATED_CONFIG not found: src/app/config/pixelated.config.json is not available.');
|
|
27
25
|
return {};
|
|
28
26
|
}
|
|
29
27
|
// Handle decryption if the content is encrypted
|
|
@@ -18,9 +18,9 @@ export async function POST(request) {
|
|
|
18
18
|
// ===== OPTION 1: File-based storage =====
|
|
19
19
|
const result = await savePage(name, data);
|
|
20
20
|
// ===== OPTION 2: Contentful storage =====
|
|
21
|
-
// ===== OPTION 2: Contentful storage (recommended when using the unified PIXELATED config
|
|
21
|
+
// ===== OPTION 2: Contentful storage (recommended when using the unified PIXELATED config) =====
|
|
22
22
|
// The app reads the unified config on the server via `getFullPixelatedConfig()` which
|
|
23
|
-
// sources values from `
|
|
23
|
+
// sources values from `src/app/config/pixelated.config.json` and uses `PIXELATED_CONFIG_KEY` for decryption.
|
|
24
24
|
// Example (server-side):
|
|
25
25
|
// import { getFullPixelatedConfig } from '@pixelated-tech/components/server';
|
|
26
26
|
// const cfg = getFullPixelatedConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/components/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CA4CxD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,eAAe,CAwBpF"}
|