Skip to content

fix: update database URL configuration to use environment variable#137

Merged
ssdeanx merged 1 commit intomainfrom
develop
Apr 15, 2026
Merged

fix: update database URL configuration to use environment variable#137
ssdeanx merged 1 commit intomainfrom
develop

Conversation

@ssdeanx
Copy link
Copy Markdown
Owner

@ssdeanx ssdeanx commented Apr 15, 2026

  • Changed the database URL in libsqlstorage and libsqlvector to use process.env.DB, ensuring flexibility for different environments.
  • Updated log information to reflect the use of the environment variable for storage and vector configurations.

Summary by Sourcery

Update database configuration to read the LibSQL URL from an environment variable and adjust related UI styling.

Bug Fixes:

  • Use the DB environment variable for LibSQL storage and vector URLs with a file-based default fallback to support configurable deployment environments.

Enhancements:

  • Align log metadata with the new environment-based LibSQL configuration for easier observability.
  • Adjust page header background blob sizing classes for updated visual styling.

- Changed the database URL in libsqlstorage and libsqlvector to use process.env.DB, ensuring flexibility for different environments.
- Updated log information to reflect the use of the environment variable for storage and vector configurations.
Copilot AI review requested due to automatic review settings April 15, 2026 14:16
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-stack Error Error Apr 15, 2026 2:47pm

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Configures LibSQL storage and vector clients to read the database URL from an environment variable with a file-based fallback, and adjusts related logging and a UI background style.

Flow diagram for database URL resolution using environment variable

flowchart TD
    A[Application start] --> B[Read environment variable DB]
    B -->|DB is set| C[Use process.env.DB as database URL]
    B -->|DB is not set| D[Fallback to file:./database.db]

    C --> E[Initialize LibSQLStore libsqlstorage]
    D --> E

    C --> F[Initialize LibSQLVector libsqlvector]
    D --> F

    E --> G[Initialize LibsqlMemory with LibSQLVector support]
    F --> G

    G --> H[Log initialization details]
    C --> H
    D --> H
Loading

File-Level Changes

Change Details Files
Use environment variable-based database URL for LibSQL storage and vector clients with a file URL fallback.
  • Replace hard-coded LibSQLStore URL with process.env.DB, defaulting to the previous file:./database.db value when unset
  • Replace hard-coded LibSQLVector URL with process.env.DB, defaulting to the previous file:./database.db value when unset
  • Update initialization logging to output the resolved database URL rather than a hard-coded file path for both storage and vector
src/mastra/config/libsql.ts
Adjust animated background sizing in the page header component.
  • Change the first motion.div background circle from Tailwind arbitrary h/w [400px] to h-100 w-100
  • Change the second motion.div background circle from Tailwind arbitrary h/w [300px] to h-75 w-75
app/components/page-header.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions
Copy link
Copy Markdown

🤖 Hi @ssdeanx, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@ssdeanx ssdeanx merged commit c69aca1 into main Apr 15, 2026
18 of 22 checks passed
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Apr 15, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
src/mastra/config/libsql.ts 129 Potential security vulnerability - logging database URL may expose credentials
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (2 files)
  • src/mastra/config/libsql.ts - 1 issue
  • app/components/page-header.tsx - 0 issues

Reviewed by grok-code-fast-1:optimized:free · 144,620 tokens

log.info('LibSQLStore and Memory initialized with LibSQLVector support', {
storage: 'file:./database.db',
vector: 'file:./database.db',
storage: process.env.DB ?? 'file:./database.db',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CRITICAL: Potential security vulnerability - logging database URL may expose credentials

The database URL logged here may contain sensitive information like usernames and passwords if process.env.DB is a connection string. Consider redacting or masking sensitive parts of the URL before logging.

Suggested change
storage: process.env.DB ?? 'file:./database.db',
storage: '[REDACTED]',

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

Warning

Rate limit exceeded

@ssdeanx has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 48 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 3 minutes and 48 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c73818bb-41b4-439c-973b-16b3ed3bbfd0

📥 Commits

Reviewing files that changed from the base of the PR and between c9394db and 92f6440.

📒 Files selected for processing (2)
  • app/components/page-header.tsx
  • src/mastra/config/libsql.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the database configuration to utilize an environment variable with a local file fallback across storage, vector, and logging settings. It also includes changes to CSS classes in the page header. Feedback highlights that the new CSS classes are non-standard Tailwind utilities and should be reverted to avoid UI regressions. Additionally, it is recommended to extract the database URL logic into a constant for maintainability and to mask the URL in logs to avoid exposing sensitive credentials.

animate={{ opacity: 0.15, scale: 1 }}
transition={{ duration: 1.5, ease: 'easeOut' }}
className="absolute left-1/2 top-0 -z-10 h-[400px] w-[400px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 blur-[100px]"
className="absolute left-1/2 top-0 -z-10 h-100 w-100 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 blur-[100px]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

These changes to the CSS classes are unrelated to the PR's objective of updating database configuration. Additionally, h-100 and w-100 are not standard Tailwind CSS utilities (the default scale ends at 96). Unless these are custom-defined in your configuration, this change will likely cause the decorative orb to have no height or width.

Suggested change
className="absolute left-1/2 top-0 -z-10 h-100 w-100 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 blur-[100px]"
className="absolute left-1/2 top-0 -z-10 h-[400px] w-[400px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 blur-[100px]"

animate={{ opacity: 0.1 }}
transition={{ duration: 2, delay: 0.3 }}
className="absolute bottom-0 right-0 -z-10 h-[300px] w-[300px] translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"
className="absolute bottom-0 right-0 -z-10 h-75 w-75 translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The classes h-75 and w-75 are not standard Tailwind CSS utilities. This change is out of scope for this PR and likely introduces a UI regression where the background decoration loses its dimensions.

Suggested change
className="absolute bottom-0 right-0 -z-10 h-75 w-75 translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"
className="absolute bottom-0 right-0 -z-10 h-[300px] w-[300px] translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"

export const libsqlstorage = new LibSQLStore({
id: 'libsql-storage',
url: 'file:./database.db',
url: process.env.DB ?? 'file:./database.db',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The database URL fallback logic process.env.DB ?? 'file:./database.db' is repeated multiple times in this file (lines 13, 25, 129, and 130). Consider extracting this into a constant at the top of the file to improve maintainability and ensure consistency across storage, vector, and logging configurations.

Comment on lines +129 to +130
storage: process.env.DB ?? 'file:./database.db',
vector: process.env.DB ?? 'file:./database.db',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-medium medium

Logging the raw database URL from process.env.DB can expose sensitive information, such as credentials, in the application logs. It is recommended to mask the connection string or log only the non-sensitive parts (e.g., the hostname).

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new Tailwind classes h-100, w-100, h-75, and w-75 are not valid by default and change the sizing from the previous fixed pixel values; consider reverting to the original h-[400px] / w-[400px] / h-[300px] / w-[300px] or using valid Tailwind spacing/size utilities.
  • The expression process.env.DB ?? 'file:./database.db' is duplicated in multiple places; consider extracting it into a single constant (e.g., const DB_URL = process.env.DB ?? 'file:./database.db') to keep the configuration DRY and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new Tailwind classes `h-100`, `w-100`, `h-75`, and `w-75` are not valid by default and change the sizing from the previous fixed pixel values; consider reverting to the original `h-[400px]` / `w-[400px]` / `h-[300px]` / `w-[300px]` or using valid Tailwind spacing/size utilities.
- The expression `process.env.DB ?? 'file:./database.db'` is duplicated in multiple places; consider extracting it into a single constant (e.g., `const DB_URL = process.env.DB ?? 'file:./database.db'`) to keep the configuration DRY and easier to maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Updates Mastra’s LibSQL storage/vector configuration to allow the database URL to be overridden via an environment variable, and adjusts a header component’s Tailwind sizing classes.

Changes:

  • Use an env var (process.env.DB) as the primary LibSQL URL for LibSQLStore and LibSQLVector, with a local file fallback.
  • Update the LibSQL init log payload to reflect the env-based URL.
  • Change Tailwind sizing utilities in PageHeader gradient decorations.

Reviewed changes

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

File Description
src/mastra/config/libsql.ts Switches LibSQL URL source from a hardcoded file path to an environment variable and logs the resolved URL.
app/components/page-header.tsx Updates Tailwind sizing classes for the gradient “orb” decoration elements.

Comment on lines +13 to 16
url: process.env.DB ?? 'file:./database.db',
maxRetries: 5, // Optional retry configuration for transient errors
initialBackoffMs: 100, // Initial backoff for retries
//disableInit: process.env.DB_DISABLE_INIT === 'true', // Disable auto-init if specified
Comment on lines 128 to +130
log.info('LibSQLStore and Memory initialized with LibSQLVector support', {
storage: 'file:./database.db',
vector: 'file:./database.db',
storage: process.env.DB ?? 'file:./database.db',
vector: process.env.DB ?? 'file:./database.db',
Comment on lines +60 to +66
className="absolute left-1/2 top-0 -z-10 h-100 w-100 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary/30 blur-[100px]"
/>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 0.1 }}
transition={{ duration: 2, delay: 0.3 }}
className="absolute bottom-0 right-0 -z-10 h-[300px] w-[300px] translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"
className="absolute bottom-0 right-0 -z-10 h-75 w-75 translate-x-1/4 translate-y-1/4 rounded-full bg-blue-500/30 blur-[80px]"
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