Skip to content

chore(backend): local-path-configs#1594

Merged
imnotjames merged 5 commits into
grimmory-tools:developfrom
sabrina553:fix/local-path-configs
May 31, 2026
Merged

chore(backend): local-path-configs#1594
imnotjames merged 5 commits into
grimmory-tools:developfrom
sabrina553:fix/local-path-configs

Conversation

@sabrina553
Copy link
Copy Markdown
Contributor

@sabrina553 sabrina553 commented May 31, 2026

Description

Introduce environment variables for path-config and backdrop-folder.

Linked Issue

fixes #1592

Changes

  1. added APP_PATH_CONFIG and APP_BOOKDROP_FOLDER to application.yaml as Environment variables
  2. added application-dev.yaml to reflect (1) as well as database configuration for the backend_db docker service
  3. updated backend/development.md to reflect the changes above.

Manual Testing Steps

  1. ran api within IDE, just run, dev-up, and just image-build && just image-run with and without environment variables set.
  2. verifying that they worked in unity across both dev environment and user environment

Screenshots (Optional)

Additional Context (Optional)

AI Disclosure

None

Checklist

  • This PR links and implements an accepted issue.
  • This PR is a single focused change.
  • There are new or updated tests validating this change.
  • I ran just ui check and just api check.
  • I have added screenshots if there were any UI changes.
  • I have disclosed any AI usage as per the organization AI Policy above.
  • I understand all of my submitted changes.

Summary by CodeRabbit

  • Documentation

    • Clarified development setup with explicit IDE profile/workdir guidance and examples to run in dev mode; documents the default development configuration file.
  • Chores

    • Added a default development configuration and made key application paths and datasource settings configurable via environment variables for simpler local and containerized development.

…FIG and APP_BOOKDROP_FOLDER as environment variables.
provides:

- Local shared directory (relative to backend/) for path-config / bookdrop-folder

- database-details for the docker backend-db

Unifies `just api::run`/ IDE and the Docker dev-environment.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

Walkthrough

Parameterize application paths with environment variables, add an application-dev.yaml dev profile with app path and datasource defaults, and update DEVELOPMENT.md with instructions to use the dev profile and IDE/bootRun settings.

Changes

Development Configuration Externalization

Layer / File(s) Summary
Environment-driven application configuration
backend/src/main/resources/application.yaml, backend/src/main/resources/application-dev.yaml
Base configuration now reads app.path-config and app.bookdrop-folder from APP_PATH_CONFIG and APP_BOOKDROP_FOLDER with defaults. New application-dev.yaml provides development defaults for app.* and spring.datasource using DATABASE_URL, DATABASE_USERNAME, and DATABASE_PASSWORD fallbacks (localhost MariaDB defaults).
Development setup and IDE configuration
backend/DEVELOPMENT.md
Documented that application-dev.yaml is the default development configuration and added IDE instructions: Spring Boot active profile/work directory and Gradle bootRun args to enable the dev profile.

Sequence Diagram(s)

sequenceDiagram
  participant SpringBoot
  participant ConfigFiles
  participant Database
  SpringBoot->>ConfigFiles: load `application.yaml` (env placeholders)
  SpringBoot->>ConfigFiles: load `application-dev.yaml` when 'dev' profile active
  SpringBoot->>Database: connect using `spring.datasource` (env or defaults)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • imajes
  • balazs-szucs
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The PR description covers all required sections with adequate detail: objectives, linked issue, changes, manual testing steps, and AI disclosure.
Linked Issues check ✅ Passed The changes fully implement issue #1592 requirements: APP_PATH_CONFIG and APP_BOOKDROP_FOLDER environment variables are added to application.yaml and application-dev.yaml, enabling configurable data and bookdrop paths with environment variable support.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective: environment variables for path configuration, development configuration file, and documentation updates—no unrelated or extraneous changes detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'chore(backend): local-path-configs' follows the conventional commit format with type and scope, and accurately describes the main change of making local paths configurable via environment variables.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@backend/DEVELOPMENT.md`:
- Around line 68-69: Add a blank line immediately after the "### IDE" Markdown
heading so the heading is properly separated from the following paragraph
("**Spring Boot:**  Active Profile = `dev`,"); update the section where the
heading "### IDE" appears to insert one empty line below it to satisfy
markdownlint MD022 and ensure correct rendering.

In `@backend/src/main/resources/application-dev.yaml`:
- Line 7: The dev datasource URL overrides the base spring.datasource.url but
omits required connection params; update the default value for the `url`
property (the `${DATABASE_URL:...}` entry) so the fallback JDBC string includes
`createDatabaseIfNotExist=true`, `connectionTimeZone=UTC`, and
`forceConnectionTimeZoneToSession=true` (keeping the existing host/port/schema
and allowing env override via DATABASE_URL) to restore parity with the base
profile and avoid timezone/schema mismatches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: e5bba260-257e-43f7-9a66-0cfb8e462ac2

📥 Commits

Reviewing files that changed from the base of the PR and between 32acb61 and 7eb184b.

📒 Files selected for processing (3)
  • backend/DEVELOPMENT.md
  • backend/src/main/resources/application-dev.yaml
  • backend/src/main/resources/application.yaml
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

**/*: This project is being developed using current and future-facing technologies:

  • Java 25 with --enable-preview (preview features are INTENTIONAL and encouraged)
  • Spring Boot 4 (latest major version, check APIs accordingly)
  • Jackson 3 (new package: tools.jackson.* instead of com.fasterxml.jackson.*)
  • Hibernate 7.3.x (Jakarta Persistence 3.2, new APIs; avoid deprecated Hibernate 5/6 patterns)
  • Angular 21 (signals-based reactivity, no NgModules unless legacy)

Grimmory Internal Tools

Metadata Standards and Compliance

  • For all metadata writing and parsing logic, double-check against Dublin Core and ANSI standards to ensure perfect official compliance.
  • We strictly follow the widespread and official XML-compliant methods for EPUB2, EPUB3, CBX, and PDF formats.

General Java and Spring rules

  • ALWAYS prefer modern, idiomatic Java 25 constructs over legacy patterns.
  • Preview features (--enable-preview) are enabled and intentional; do NOT flag them as risky unless there is a concrete runtime issue.
  • Prefer: records, sealed classes/interfaces, pattern matching (switch expressions, instanceof), structured concurrency (StructuredTaskScope), scoped values, string templates, unnamed patterns/variables.
  • Prefer virtual threads (Thread.ofVirtual(), Executors.newVirtualThreadPerTaskExecutor()) over platform threads for I/O-bound work.
  • Prefer the new Sequenced Collections API (SequencedCollection, SequencedMap) where applicable.
  • Prefer var for local variables when the type is obvious from context.
  • Use stream().toList() instead of stream().collect(Collectors.toList()) for imm...

Files:

  • backend/src/main/resources/application.yaml
  • backend/DEVELOPMENT.md
  • backend/src/main/resources/application-dev.yaml
🧠 Learnings (1)
📚 Learning: 2026-05-18T14:54:39.422Z
Learnt from: alexhb1
Repo: grimmory-tools/grimmory PR: 1379
File: frontend/src/assets/styles/tailwind.css:3-4
Timestamp: 2026-05-18T14:54:39.422Z
Learning: In the grimmory-tools/grimmory repository, Biome is not used for linting/formatting (no `biome.json` and no Biome dependency in `package.json`). During code reviews, do not raise Biome-related issues or recommend adding/changing `biome.json`/Biome dependencies for formatting or linting in this project.

Applied to files:

  • backend/DEVELOPMENT.md
🪛 markdownlint-cli2 (0.22.1)
backend/DEVELOPMENT.md

[warning] 68-68: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🔀 Multi-repo context grimmory-tools/grimmory-docs

Linked repositories findings

grimmory-tools/grimmory-docs

  • docs/installation.md — references bookdrop path and Docker volume mapping (./bookdrop:/bookdrop) and suggests creating ~/grimmory/bookdrop. [::grimmory-tools/grimmory-docs::docs/installation.md]
  • docs/getting-started.md — instructs creating ~/grimmory/{...,bookdrop} and shows Docker mapping ./bookdrop:/bookdrop. [::grimmory-tools/grimmory-docs::docs/getting-started.md]
  • docs/bookdrop.md — multiple references to /bookdrop and examples showing - /path/to/bookdrop:/bookdrop (UI screenshots and explanatory text). [::grimmory-tools/grimmory-docs::docs/bookdrop.md]
  • sidebars.ts — contains entries linking Bookdrop docs (indirect consumer of bookdrop documentation). [::grimmory-tools/grimmory-docs::sidebars.ts]

Notes: I did not find occurrences of the new environment variable names (APP_PATH_CONFIG or APP_BOOKDROP_FOLDER) in this repo; docs currently assume /bookdrop or a host-mounted ./bookdrop path.

🔇 Additional comments (1)
backend/src/main/resources/application.yaml (1)

2-3: LGTM!

Comment thread backend/DEVELOPMENT.md
Comment thread backend/src/main/resources/application-dev.yaml Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@imnotjames imnotjames left a comment

Choose a reason for hiding this comment

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

Good aside from the minor markdown nit

Co-authored-by: James Ward <james@notjam.es>
@imnotjames imnotjames changed the title fix(backend): local-path-configs chore(backend): local-path-configs May 31, 2026
@imnotjames imnotjames merged commit 02cdaef into grimmory-tools:develop May 31, 2026
18 checks passed
@imnotjames
Copy link
Copy Markdown
Contributor

Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow local path configurations via env vars

2 participants