Page MenuHomePhabricator

Replace Dotenv with Spring @Value and update environment setup docs
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Replace the io.github.cdimascio.dotenv.Dotenv library with Spring's native org.springframework.beans.factory.annotation.Value (@Value) annotation across the project for injecting environment variables. Additionally, update the README.md file to clearly state that the .env file is no longer loaded automatically, and provide instructions on how to pass environment variables (e.g., via standard Spring Boot configuration, IDE settings, or system environment variables).

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
While reviewing the project's configuration management and pom.xml, I noticed the usage of the cdimascio/java-dotenv dependency to manage environment variables. The underlying problem is that using an external library for this purpose in a Spring Boot application is redundant. Spring Boot already provides robust, built-in mechanisms for environment variable resolution and property injection. Relying on an external library adds unnecessary dependencies and deviates from standard Spring Boot configuration practices.

Benefits (why should this be implemented?):

  • Dependency Reduction: Removes a third-party dependency from the project, reducing bloat and potential maintenance/security overhead.
  • Best Practices: Aligns the project with standard Spring Boot idioms for configuration management.
  • Simplicity: Unifies how properties and environment variables are handled within the Spring Application Context.

Event Timeline

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly point to the codebase URL and provide clear steps to help a contributor get set up for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

Praffq subscribed.

I'll like to fix this issue.