Better environment variable use

This commit is contained in:
Ethanell 2020-04-26 23:38:10 +02:00
parent a7dd52b134
commit 4064be3280

6
app.js
View file

@ -29,9 +29,9 @@ if (!fs.existsSync("users.json")) {
app.use(morgan("dev")) app.use(morgan("dev"))
.use(express.static("public")) .use(express.static("public"))
.use(bodyParser.urlencoded({ extended: true })) .use(bodyParser.urlencoded({ extended: true }))
.use(cookieParser(process.env.SECRET)) .use(cookieParser(process.env.SECRET || "Keyboard cat"))
.use(session({ .use(session({
secret: process.env.SECRET, secret: process.env.SECRET || "Keyboard cat",
resave: false, resave: false,
saveUninitialized: false, saveUninitialized: false,
cookie: { secure: "auto" } cookie: { secure: "auto" }
@ -44,5 +44,5 @@ app.use(morgan("dev"))
.use("/images", imagesRoute) .use("/images", imagesRoute)
.use(notFoundRoute) .use(notFoundRoute)
.use(errorRoute) .use(errorRoute)
.listen(8080); .listen(process.env.PORT || 8080);