Skip to content

Commit

Permalink
Try without the customized cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pelayo-Reguera committed May 4, 2023
1 parent 4270e88 commit b07cbae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/lomap_en3a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ jobs:
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
registry: ghcr.io
workdir: restapi
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-restapi,docker-push-webapp]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
with:
host: ${{ secrets.DEPLOY_HOST }}
user: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
command: |
wget https://raw.githubusercontent.com/arquisoft/lomap_en3a/deployment-ivan/docker-compose-deploy.yml -O docker-compose.yml
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose up -d
# deploy:
# name: Deploy over SSH
# runs-on: ubuntu-latest
# needs: [docker-push-restapi,docker-push-webapp]
# steps:
# - name: Deploy over SSH
# uses: fifsky/ssh-action@master
# with:
# host: ${{ secrets.DEPLOY_HOST }}
# user: ${{ secrets.DEPLOY_USER }}
# key: ${{ secrets.DEPLOY_KEY }}
# command: |
# wget https://raw.githubusercontent.com/arquisoft/lomap_en3a/deployment-ivan/docker-compose-deploy.yml -O docker-compose.yml
# docker-compose stop
# docker-compose rm -f
# docker-compose pull
# docker-compose up -d
14 changes: 1 addition & 13 deletions restapi/api.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
import express, { Router } from 'express';
import {getPlaces, addPlace, deletePlace, updatePlace, findPlaceByTitle} from "./src/controllers/places/PlacesController";
import {addPlaceChecks, deletePlaceChecks, updatePlaceChecks, findPlaceByTitleChecks} from "./src/controllers/checks"
import cors from "cors";
import {addPlaceChecks, deletePlaceChecks, updatePlaceChecks, findPlaceByTitleChecks} from "./src/controllers/checks";

const api:Router = express.Router()
let hostIp: string = "20.168.251.141";

api.use(
cors({
credentials: true,
origin: ["https://20.168.251.141", "https://lomapen3a.cloudns.ph", "https://localhost",
"https://20.168.251.141:443", "https://lomapen3a.cloudns.ph:443", "https://localhost:443"],
allowedHeaders: ["Content-Type", "Authorization"],
preflightContinue: true,
})
);

api.get("/places/list", getPlaces);
api.post("/places/add", addPlaceChecks, addPlace);
Expand Down
7 changes: 3 additions & 4 deletions restapi/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ mongoose.connect(uri, options).then(
const metricsMiddleware:RequestHandler = promBundle({includeMethod: true});
app.use(metricsMiddleware);

app.use(cors());
app.use(bp.json());

app.use("/api", api)

try {
// let privateKey = readFileSync("claves/privkey.pem");
// let certificate = readFileSync("claves/fullchain.pem");
let privateKey = readFileSync("claves/alice.key");
let certificate = readFileSync("claves/alice.crt");
let privateKey = readFileSync("claves/privkey.pem");
let certificate = readFileSync("claves/fullchain.pem");
let credentials = { key: privateKey, cert: certificate };

app.all('*', function(req, res, next){
Expand Down

0 comments on commit b07cbae

Please sign in to comment.