Add password in .env

This commit is contained in:
Quentin ANIERE 2022-04-26 22:27:56 +02:00
parent 5d66eb473a
commit 3a893d202e
4 changed files with 9 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules
*.pem
docker-compose.yaml
.env

View File

@ -1,5 +1,6 @@
const fs = require("fs");
const https = require("https");
const dotenv = require('dotenv').config();
const express = require("express");
const socketio = require("socket.io");
const sanitizeHtml = require("sanitize-html");
@ -99,7 +100,7 @@ io.on("connection", (client) => {
app.use(express.static("src"));
app.get("/clear", basicAuth({users:{"quentin": "BlanquerCaca89"}, challenge: true}), (req, res) => {
app.get("/clear", basicAuth({users:{"quentin": process.env.ADMIN_PASSWORD}, challenge: true}), (req, res) => {
messagesHistory = [];
res.send("message history was cleared");
io.sockets.emit("refresh");

View File

@ -4,6 +4,7 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.0",
"express": "^4.17.3",
"express-basic-auth": "^1.2.1",
"sanitize-html": "^2.7.0",

View File

@ -206,6 +206,11 @@ domutils@^2.5.2:
domelementtype "^2.2.0"
domhandler "^4.2.0"
dotenv@^16.0.0:
version "16.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.0.tgz#c619001253be89ebb638d027b609c75c26e47411"
integrity sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"