Skip to content

Commit 802d8ac

Browse files
authored
Merge pull request #426 from Worklenz/development
Development
2 parents 8738117 + e546bed commit 802d8ac

10 files changed

Lines changed: 71 additions & 69 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ out/
2323
!.env.example
2424
!.env.template
2525

26+
# Locally generated TLS certificates and private keys
27+
nginx/ssl/*.pem
28+
!nginx/ssl/.gitkeep
29+
2630
# Logs
2731
logs
2832
*.log
@@ -82,4 +86,4 @@ $RECYCLE.BIN/
8286
CLAUDE.md
8387

8488
graphify-out
85-
.playwright-mcp
89+
.playwright-mcp

docker-compose.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
services:
22
frontend:
3-
build:
4-
context: ./worklenz-frontend
5-
dockerfile: Dockerfile
3+
image: chamikajaycey/worklenz-frontend:3.1.0-beta
64
container_name: worklenz_frontend
75
ports:
86
- "5000:5000"
@@ -15,9 +13,7 @@ services:
1513
- worklenz
1614

1715
backend:
18-
build:
19-
context: ./worklenz-backend
20-
dockerfile: Dockerfile
16+
image: chamikajaycey/worklenz-backend:3.1.0-beta
2117
container_name: worklenz_backend
2218
ports:
2319
- "3000:3000"
@@ -32,15 +28,16 @@ services:
3228
environment:
3329
DB_HOST: db
3430
DB_PORT: 5432
31+
# Allows the current published image to start when Google OAuth is not configured.
32+
# Replace these defaults with real credentials in .env to enable Google sign-in.
33+
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-disabled}
34+
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-disabled}
35+
GOOGLE_CALLBACK_URL: ${GOOGLE_CALLBACK_URL:-https://localhost/api/auth/google/verify}
3536
networks:
3637
- worklenz
3738

3839
client-portal:
39-
build:
40-
context: ./worklenz-client-portal
41-
dockerfile: Dockerfile
42-
args:
43-
VITE_API_BASE_URL: ${CLIENT_PORTAL_API_BASE_URL:-http://backend:3000/api/client-portal}
40+
image: chamikajaycey/worklenz-client-portal:latest
4441
container_name: worklenz_client_portal
4542
ports:
4643
- "5174:5174"
@@ -50,6 +47,23 @@ services:
5047
networks:
5148
- worklenz
5249

50+
nginx:
51+
image: nginx:alpine
52+
container_name: worklenz_nginx
53+
ports:
54+
- "80:80"
55+
- "443:443"
56+
depends_on:
57+
- frontend
58+
- backend
59+
restart: unless-stopped
60+
volumes:
61+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
62+
- ./nginx/conf.d:/etc/nginx/conf.d:ro
63+
- ./nginx/ssl:/etc/nginx/ssl:ro
64+
networks:
65+
- worklenz
66+
5367
minio:
5468
image: minio/minio:latest
5569
container_name: worklenz_minio

manage.sh

100644100755
File mode changed.

nginx/ssl/.gitkeep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

nginx/ssl/cert.pem

Lines changed: 0 additions & 21 deletions
This file was deleted.

nginx/ssl/key.pem

Lines changed: 0 additions & 28 deletions
This file was deleted.

worklenz-backend/database/00_init.sh

100644100755
File mode changed.

worklenz-backend/src/passport/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import LocalSignup from "./passport-strategies/passport-local-signup";
1717
export default (passport: PassportStatic) => {
1818
passport.use("local-login", LocalLogin);
1919
passport.use("local-signup", LocalSignup);
20-
passport.use(GoogleLogin);
20+
if (GoogleLogin) {
21+
passport.use(GoogleLogin);
22+
}
2123
passport.use("google-mobile", GoogleMobileLogin);
2224
passport.use("apple-mobile", AppleMobileLogin);
2325

worklenz-backend/src/passport/passport-strategies/passport-google.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,26 @@ async function handleGoogleLogin(req: Request, _accessToken: string, _refreshTok
9898
* Passport strategy for authenticate with google
9999
* http://www.passportjs.org/packages/passport-google-oauth20/
100100
*/
101-
export default new GoogleStrategy.Strategy({
102-
clientID: process.env.GOOGLE_CLIENT_ID as string,
103-
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
104-
callbackURL: process.env.GOOGLE_CALLBACK_URL as string,
105-
passReqToCallback: true
106-
},
107-
(req, _accessToken, _refreshToken, profile, done) => void handleGoogleLogin(req, _accessToken, _refreshToken, profile, done));
101+
const googleClientId = process.env.GOOGLE_CLIENT_ID;
102+
const googleClientSecret = process.env.GOOGLE_CLIENT_SECRET;
103+
const googleCallbackUrl = process.env.GOOGLE_CALLBACK_URL;
104+
105+
const GoogleLogin =
106+
googleClientId &&
107+
googleClientId !== "disabled" &&
108+
googleClientSecret &&
109+
googleClientSecret !== "disabled" &&
110+
googleCallbackUrl
111+
? new GoogleStrategy.Strategy(
112+
{
113+
clientID: googleClientId,
114+
clientSecret: googleClientSecret,
115+
callbackURL: googleCallbackUrl,
116+
passReqToCallback: true
117+
},
118+
(req, _accessToken, _refreshToken, profile, done) =>
119+
void handleGoogleLogin(req, _accessToken, _refreshToken, profile, done)
120+
)
121+
: null;
122+
123+
export default GoogleLogin;

worklenz-backend/src/routes/auth/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import { resetPasswordLimiter, updatePasswordLimiter } from "../../middlewares/r
1414

1515
const authRouter = express.Router();
1616

17+
const isGoogleOAuthConfigured = Boolean(
18+
process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_ID !== "disabled" &&
19+
process.env.GOOGLE_CLIENT_SECRET && process.env.GOOGLE_CLIENT_SECRET !== "disabled" &&
20+
process.env.GOOGLE_CALLBACK_URL
21+
);
22+
1723
// Local authentication
1824
const options = (key: string): passport.AuthenticateOptions => ({
1925
failureRedirect: `/secure/verify?strategy=${key}`,
@@ -33,6 +39,10 @@ authRouter.post("/verify-captcha", safeControllerFunction(AuthController.verifyC
3339

3440
// Google authentication
3541
authRouter.get("/google", (req, res, next) => {
42+
if (!isGoogleOAuthConfigured) {
43+
return res.status(503).json({ message: "Google sign-in is not configured" });
44+
}
45+
3646
return passport.authenticate("google", {
3747
scope: ["email", "profile"],
3848
state: JSON.stringify({
@@ -45,6 +55,10 @@ authRouter.get("/google", (req, res, next) => {
4555
});
4656

4757
authRouter.get("/google/verify", (req, res, next) => {
58+
if (!isGoogleOAuthConfigured) {
59+
return res.status(503).json({ message: "Google sign-in is not configured" });
60+
}
61+
4862
let sessionError = "";
4963
if ((req.session as any).error) {
5064
sessionError = `?error=${encodeURIComponent((req.session as any).error as string)}`;

0 commit comments

Comments
 (0)