cf-envsync 0.3.6 → 0.3.8

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13196,9 +13196,14 @@ async function loadEnvFile(filePath, env2, projectRoot, encryption) {
13196
13196
  }
13197
13197
  if (encryption === "password") {
13198
13198
  const envMap = parsePlainEnv(content);
13199
+ const hasEncryptedValues = Object.values(envMap).some((v2) => v2.startsWith("envsync:v1:"));
13199
13200
  const password = findPassword(env2, projectRoot);
13200
- if (!password)
13201
+ if (!password) {
13202
+ if (hasEncryptedValues) {
13203
+ throw new Error(`${filePath} contains encrypted values but no password found. ` + `Set ENVSYNC_PASSWORD${env2 ? `_${env2.toUpperCase()}` : ""} or create .env.password`);
13204
+ }
13201
13205
  return envMap;
13206
+ }
13202
13207
  return decryptEnvMap(envMap, password);
13203
13208
  }
13204
13209
  const privateKey = findPrivateKey(env2, projectRoot);
@@ -13276,7 +13281,7 @@ async function resolveAppEnv(config, app, environment) {
13276
13281
  if (Object.keys(rootEnv).length > 0) {
13277
13282
  layers.push({ source: rootEnvPath, map: rootEnv });
13278
13283
  }
13279
- if (config.raw.envFiles.perApp) {
13284
+ if (config.raw.envFiles.perApp && environment !== "local") {
13280
13285
  const appEnvPath = getAppEnvPath(config, app, environment);
13281
13286
  if (normalize(appEnvPath) !== normalize(rootEnvPath)) {
13282
13287
  const appEnv = await loadEnvFile(appEnvPath, environment, config.projectRoot, encryption);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-envsync",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "Sync .env files to Cloudflare Workers secrets, .dev.vars, and more",
5
5
  "type": "module",
6
6
  "exports": {