Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Moving environment variables of docker-compose.yml to .dockercompose_env file #1055

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DharunKumar04
Copy link

Move Environment Variables to env File

Refactored the setup to move environment variables from docker-compose.yml to a .dockercompose_env file for better maintainability. This makes managing secrets easier and keeps the docker-compose.yml cleaner.

Copy link

gitguardian bot commented Jan 9, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10005301 Triggered Generic Password 2da3c55 docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@DharunKumar04
Copy link
Author

@sabaimran / @debanjum This will improve user experience for self hosting options .

Copy link
Member

Choose a reason for hiding this comment

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

Overall, this could improve the self-hosting experience by consolidating many of the user-configuration options into one file!

One potential issue I see is that it increases complexity of setup, because it requires a two-file install vs. one file. I would also rename the file to something like .khoj_docker_compose_env for specificity.

Another issue is that some environment variable names would be repurposed between containers implicitly, and it may not immediately be clear how. For example, the POSTGRES_* related variables.

This could be mitigated if we wrap the overall setup process within a shell script that can guide the user through setup via CLI, so they don't have to worry about the internals. A prerequisite to setup could be that Docker Desktop be installed.

Open to thoughts. Thanks for creating the PR. If we do accept this change, the Docker setup instructions would need to be updated.

Copy link
Author

Choose a reason for hiding this comment

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

A shell script isn’t necessary since the setup is straightforward with Docker Compose. Renaming the file to .khoj_docker_compose_env is a great idea as it makes the configuration clear for new users.

Copy link
Author

Choose a reason for hiding this comment

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

Another issue is that some environment variable names would be repurposed between containers implicitly, and it may not immediately be clear how. For example, the POSTGRES_* related variables.

Since there’s no scaling involved, repurposing environment variables seems over-engineered in my opinion.

Copy link
Member

Choose a reason for hiding this comment

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

The environment variables are already being repurposed, but the single compose file makes it opaque which containers are using which variables.

Copy link
Author

Choose a reason for hiding this comment

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

if you have plans on revamping this do let me know , happy to support khoj .

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