Skip to content

Refactor database credentials and clean up code#113

Merged
mahata merged 4 commits intomainfrom
refactor/dedupe-logic
Mar 14, 2026
Merged

Refactor database credentials and clean up code#113
mahata merged 4 commits intomainfrom
refactor/dedupe-logic

Conversation

@mahata
Copy link
Copy Markdown
Owner

@mahata mahata commented Mar 14, 2026

Extract database credentials into a separate configuration file to enhance code organization and maintainability. Clean up unnecessary code and improve type usage for user objects throughout the application.

Copilot AI review requested due to automatic review settings March 14, 2026 06:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors database connection configuration into a shared module and standardizes User typing across routes/components, while removing noisy logging and simplifying client-side chat setup.

Changes:

  • Centralize Postgres connection options in hono/db/config.ts and reuse from both runtime DB setup and drizzle.config.ts.
  • Introduce a shared User type in hono/types.ts and replace inline user-object casts across routes/components.
  • Simplify chat client script and remove excessive server-side console logging.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
hono/types.ts Adds shared User type used across server and components.
hono/static/ChatPage.ts Removes data-attribute-driven class config; uses fixed constants and keeps WS URL from data-ws-url.
hono/routes/ws.ts Uses shared User type and refactors inbound WS message decoding.
hono/routes/messages.ts Uses shared User type for session user and minor import cleanup.
hono/routes/index.tsx Uses shared User type and removes debug logging around auth/redirect.
hono/routes/auth.ts Removes verbose OAuth debug logging while keeping session user persistence.
hono/db/index.ts Switches pool creation to use centralized dbCredentials.
hono/db/config.ts New shared DB credentials module (env parsing + defaults + ssl).
hono/components/ChatPage.tsx Imports shared User type and removes now-unused data attributes.
drizzle.config.ts Reuses dbCredentials for drizzle-kit configuration.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread drizzle.config.ts Outdated
Comment thread hono/db/config.ts Outdated
Comment on lines +1 to +7
export const dbCredentials = {
host: process.env.POSTGRES_HOST || "localhost",
port: Number(process.env.POSTGRES_PORT) || 5437,
user: process.env.POSTGRES_USER || "postgres",
password: process.env.POSTGRES_PASSWORD || "mysecretpassword",
database: process.env.POSTGRES_DB || "postgres",
ssl: process.env.NODE_ENV === "production" ? { rejectUnauthorized: false } : false,
Comment thread hono/routes/ws.ts
Comment on lines +20 to +25
const messageStr =
typeof message === "string"
? message
: message instanceof Blob
? await message.text()
: new TextDecoder().decode(message);
mahata and others added 3 commits March 14, 2026 15:25
@mahata mahata merged commit b0837e2 into main Mar 14, 2026
2 checks passed
@mahata mahata deleted the refactor/dedupe-logic branch March 14, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants