mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
fix: add baseUrl in passport oauth
This commit is contained in:
1 parent
a69f4960b2
commit
33582a4827
6 files changed
+10
-3
No files matched your search
@@ -36,6 +36,7 @@ services:
|
|||||||
- mongo:/data/db
|
- mongo:/data/db
|
||||||
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
|
||||||
environment:
|
environment:
|
||||||
|
- BASE_URL=https://example.com
|
||||||
- MONGO_INITDB_ROOT_USERNAME=admin
|
- MONGO_INITDB_ROOT_USERNAME=admin
|
||||||
- MONGO_INITDB_ROOT_PASSWORD=admin-password
|
- MONGO_INITDB_ROOT_PASSWORD=admin-password
|
||||||
- MONGO_USER=user
|
- MONGO_USER=user
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
environment:
|
environment:
|
||||||
|
- BASE_URL=http://localhost:5173
|
||||||
- MONGO_URL=mongodb://user:user-password@db-test:27017/odyssey-test
|
- MONGO_URL=mongodb://user:user-password@db-test:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ services:
|
|||||||
- ./packages:/app/packages
|
- ./packages:/app/packages
|
||||||
- ./quests:/app/quests
|
- ./quests:/app/quests
|
||||||
environment:
|
environment:
|
||||||
|
- BASE_URL=http://localhost:5173
|
||||||
- MONGO_URL=mongodb://db:27017/odyssey-test
|
- MONGO_URL=mongodb://db:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
- HOST_PWD=${PWD}
|
- HOST_PWD=${PWD}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export default enabled
|
|||||||
{
|
{
|
||||||
clientID: config.google.clientID,
|
clientID: config.google.clientID,
|
||||||
clientSecret: config.google.clientSecret,
|
clientSecret: config.google.clientSecret,
|
||||||
callbackURL: '/api/v1/auth/google/callback',
|
callbackURL: `${config.baseUrl}/api/v1/auth/google/callback`,
|
||||||
scope: ['profile', 'email'],
|
scope: ['profile', 'email'],
|
||||||
},
|
},
|
||||||
verify
|
verify
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { get } from './utils/env.js'
|
import { get } from './utils/env.js'
|
||||||
|
|
||||||
export default {
|
const config = {
|
||||||
host: get('HOST', 'localhost'),
|
host: get('HOST', 'localhost'),
|
||||||
port: get('PORT', 3000),
|
port: get('PORT', 3000),
|
||||||
db: get('MONGO_URL', 'mongodb://localhost:27017/odyssey-test'),
|
db: get('MONGO_URL', 'mongodb://localhost:27017/odyssey-test'),
|
||||||
@@ -15,3 +15,7 @@ export default {
|
|||||||
clientSecret: get('GOOGLE_CLIENT_SECRET', ''),
|
clientSecret: get('GOOGLE_CLIENT_SECRET', ''),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.baseUrl = get('BASE_URL', `http://${config.host}:${config.port}`)
|
||||||
|
|
||||||
|
export default config
|
||||||
+1
-1
@@ -49,7 +49,7 @@ async function main() {
|
|||||||
app.use('/api/v1', apiRouter)
|
app.use('/api/v1', apiRouter)
|
||||||
|
|
||||||
server.listen(config.port, config.host, () => {
|
server.listen(config.port, config.host, () => {
|
||||||
console.log(`Server listening at http://${config.host}:${config.port}`)
|
console.log(`Server listening at ${config.baseUrl}`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user