added some dev environment stuff
This commit is contained in:
@@ -3,4 +3,5 @@ SERVER_ROOT=/climate
|
||||
MYSQL_ADDRESS=192.168.0.198
|
||||
MYSQL_USERNAME=admin
|
||||
MYSQL_PW=sekna123jk
|
||||
SENSOR_PING_INTERVAL=30
|
||||
SENSOR_PING_INTERVAL=30
|
||||
DEV=true
|
||||
@@ -4,6 +4,7 @@ import {newMainRouter} from "./mainRouter";
|
||||
import {setupCollections} from "./Collections";
|
||||
import path from "path";
|
||||
import {startSensorPinger} from "./pingSensors";
|
||||
import cors from "cors";
|
||||
|
||||
dotenv.config({ path: path.resolve(__dirname + "/.env") });
|
||||
const SERVER_ROOT = process.env.SERVER_ROOT ?? "/";
|
||||
@@ -14,6 +15,11 @@ async function main() {
|
||||
const mainRouter = newMainRouter(collections);
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
if (process.env.DEV) {
|
||||
app.use(cors({
|
||||
origin: "http://192.168.0.181/"
|
||||
}));
|
||||
}
|
||||
app.set("port", process.env.PORT || 3000);
|
||||
app.use(express.urlencoded({ extended: false}));
|
||||
app.locals = {
|
||||
|
||||
Reference in New Issue
Block a user