Skip to content

Commit

Permalink
app: fix reading CSP nonce issue from csp-nonce.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurg committed Jul 26, 2023
1 parent 3150ef0 commit 7f93821
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import fs from "fs";
import path from "path";
import tr from "vuetify/es5/locale/tr";

let cspNonce = "";
if (process.env.NODE_EV === "production") {
let cspNonce = "development-mode";
const cspNonceTxtPath = path.join(__dirname, "csp-nonce.txt");
const cspNonceTxt = fs.existsSync(cspNonceTxtPath);
if (cspNonceTxt) {
// create-csp-nonce-txt.js
cspNonce = fs.readFileSync(path.join(__dirname, "csp-nonce.txt"), { encoding: "utf-8" });
cspNonce = fs.readFileSync(cspNonceTxtPath, { encoding: "utf-8" });
}

export default {
Expand Down

0 comments on commit 7f93821

Please sign in to comment.