{"size": 655, "ext": "js", "max_stars_repo_path": "bin/encrypt-secrets.js", "max_stars_repo_name": "ryan-blunden/vercel-gitops-secrets-nextjs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bin/encrypt-secrets.js", "max_issues_repo_name": "ryan-blunden/vercel-gitops-secrets-nextjs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bin/encrypt-secrets.js", "max_forks_repo_name": "ryan-blunden/vercel-gitops-secrets-nextjs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 38.5294117647, "max_line_length": 109, "alphanum_fraction": 0.7312977099}
const fs = require("fs")
const secrets = require("gitops-secrets");
const ENCRYPTED_SECRETS_PATH = "./lib/secrets.enc.js"

try {
  // Fetch secrets in JSON format for easy dserialization and avoiding potential  .env file formatting issues
  const DOPPLER_SECRETS = secrets.providers.doppler.fetch("json");

  // Encrypt the secrets as a JS module format (cjs | esm) for easy access at runtime
  secrets.encryptToFile("./lib/secrets.enc.js", DOPPLER_SECRETS, { format: "cjs" });
  
  console.log(`Successfully encrypted secrets to ${ENCRYPTED_SECRETS_PATH}`)
} catch (error) {
  console.log(`Error encrypting secrets file: ${error}`);
  process.exit(1);
}
