mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 19:34:34 +00:00
fix(docker): docker-compose for prod+development
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
MODE=[server]
|
||||
CORS=[enable]
|
||||
PORT_WEB=[port for sasjs web component(react)]
|
||||
ACCESS_TOKEN_SECRET=<secret>
|
||||
REFRESH_TOKEN_SECRET=<secret>
|
||||
AUTH_CODE_SECRET=<secret>
|
||||
|
||||
@@ -3,7 +3,6 @@ WORKDIR /usr/server/api
|
||||
COPY ["package.json","package-lock.json", "./"]
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
EXPOSE 5000
|
||||
# RUN chown -R node /usr/server/api
|
||||
# USER node
|
||||
CMD ["npm","start"]
|
||||
|
||||
@@ -13,10 +13,12 @@ dotenv.config()
|
||||
|
||||
const app = express()
|
||||
|
||||
const { MODE, CORS } = process.env
|
||||
const { MODE, CORS, PORT_WEB } = process.env
|
||||
if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') {
|
||||
console.log('All CORS Requests are enabled')
|
||||
app.use(cors({ credentials: true, origin: 'http://localhost:3000' }))
|
||||
app.use(
|
||||
cors({ credentials: true, origin: `http://localhost:${PORT_WEB ?? 3000}` })
|
||||
)
|
||||
}
|
||||
|
||||
app.use(express.json({ limit: '50mb' }))
|
||||
|
||||
Reference in New Issue
Block a user