@pixelated-tech/components 3.7.10 → 3.7.12

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 PIXELATED_CONFIG_JSON or PIXELATED_CONFIG_B64 environment variables are set.');
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 = process.env.PIXELATED_CONFIG_JSON || (process.env.PIXELATED_CONFIG_B64 && Buffer.from(process.env.PIXELATED_CONFIG_B64, 'base64').toString('utf8'));
11
- let source = process.env.PIXELATED_CONFIG_JSON ? 'PIXELATED_CONFIG_JSON' : (process.env.PIXELATED_CONFIG_B64 ? 'PIXELATED_CONFIG_B64' : 'none');
12
- // If not in environment, try reading from the conventional file location
13
- if (!raw) {
14
- const configPath = path.join(process.cwd(), 'src/app/config/pixelated.config.json');
15
- if (fs.existsSync(configPath)) {
16
- try {
17
- raw = fs.readFileSync(configPath, 'utf8');
18
- source = 'src/app/config/pixelated.config.json';
19
- }
20
- catch (err) {
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: neither environment variables nor src/app/config/pixelated.config.json are available.');
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
@@ -61,6 +59,9 @@ export function getFullPixelatedConfig() {
61
59
  export function getClientOnlyPixelatedConfig(full) {
62
60
  const src = full ?? getFullPixelatedConfig();
63
61
  function isSecretKey(key) {
62
+ // Explicitly allow common public-facing keys
63
+ if (/api_key|apikey|public_key/i.test(key))
64
+ return false;
64
65
  return /token|secret|key|password|management|access/i.test(key);
65
66
  }
66
67
  function strip(obj) {
@@ -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 blob) =====
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 `PIXELATED_CONFIG_JSON` or `PIXELATED_CONFIG_B64`.
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,CA8CxD;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,eAAe,CAwBpF"}
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,CA0BpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelated-tech/components",
3
- "version": "3.7.10",
3
+ "version": "3.7.12",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Pixelated Technologies",