Skip to content

Conversation

@MrOrz
Copy link
Member

@MrOrz MrOrz commented Sep 8, 2025

Moves all environment variables from inline environment sections to dedicated env files for better configuration management.

This addresses the issue where having environment variables in both docker-compose files and env files made configuration difficult to manage.

Changes

  • Created 23 new env files in env-files.sample/ organized by service and environment
  • Updated both docker-compose files to use env_file exclusively
  • Maintains all existing functionality while improving maintainability
  • Prevents configuration from being scattered between files

Fixes #37

🤖 Generated with Claude Code

- Created 23 new env files in env-files.sample/ directory
- Updated both docker-compose.sample.yml and docker-compose.production.yml to use env_file instead of inline environment variables
- Organized environment variables by service and deployment type for easier management
- Maintains all existing functionality while improving secret management
- Prevents mixing configuration between docker-compose and env files

Co-authored-by: Johnson Liang <[email protected]>
Copy link

@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.

Summary of Changes

Hello @MrOrz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how environment variables are managed within the Docker Compose setup. It aims to centralize environment configurations into dedicated files, improving maintainability and preventing scattered variable definitions across multiple docker-compose files. This change maintains all existing functionality while streamlining the configuration process.

Highlights

  • Centralized Environment Variables: All inline environment variables from docker-compose files have been moved to dedicated .env files.
  • New .env Files Created: 23 new .env files have been created under env-files.sample/, organized by service and environment, to hold specific configurations.
  • Docker Compose Configuration Update: Both docker-compose.production.yml and docker-compose.sample.yml now exclusively use the env_file directive, pointing to the new .env files, enhancing modularity.
  • Improved Maintainability: This refactoring significantly improves configuration management by consolidating environment variables, making them easier to track, update, and manage across different environments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 does a great job of centralizing environment variables into dedicated .env files, which significantly improves configuration management and maintainability. However, there is a critical issue in docker-compose.production.yml where services are pointed to sample environment files, which would break a production deployment. Additionally, all newly created environment files are missing a final newline character, which is a common convention and can cause issues with some tools.

gcp-project: <GCP project>
env_file:
- ./env-files/line-bot-zh
- ./env-files.sample/line-bot-zh

Choose a reason for hiding this comment

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

high

Using env-files.sample for a production configuration is incorrect. The env-files.sample directory contains placeholder values for development and demonstration. For production, you should use a separate directory (e.g., env-files) with the actual secrets, which is typically not checked into version control. This change from ./env-files/line-bot-zh to ./env-files.sample/line-bot-zh will likely break the service. This applies to all other services in this file as well; they should all point to non-sample env files.

      - ./env-files/line-bot-zh

GCS_BUCKET_NAME=
GCS_IMAGE_FOLDER=
INTERNET_ARCHIVE_S3_ACCESS_KEY=
INTERNET_ARCHIVE_S3_SECRET_KEY= No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

INTERNET_ARCHIVE_S3_SECRET_KEY=

INTERNET_ARCHIVE_S3_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=
LANGFUSE_SECRET_KEY=
LANGFUSE_BASEURL=https://langfuse.cofacts.tw No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

LANGFUSE_BASEURL=https://langfuse.cofacts.tw

INTERNET_ARCHIVE_S3_SECRET_KEY=
LANGFUSE_PUBLIC_KEY=
LANGFUSE_SECRET_KEY=
LANGFUSE_BASEURL=https://langfuse.cofacts.tw No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

LANGFUSE_BASEURL=https://langfuse.cofacts.tw

@@ -0,0 +1 @@
TUNNEL_TOKEN=CHANGE_ME No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

TUNNEL_TOKEN=CHANGE_ME

PUBLIC_API_URL=https://dev-api.cofacts.tw
PUBLIC_COLLAB_SERVER_URL=wss://dev-collab.cofacts.tw
PUBLIC_APP_ID=RUMORS_SITE
PUBLIC_GA_TRACKING_ID= No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

PUBLIC_GA_TRACKING_ID=

PUBLIC_API_URL=https://dev-api.cofacts.tw
PUBLIC_COLLAB_SERVER_URL=wss://dev-collab.cofacts.tw
PUBLIC_APP_ID=RUMORS_SITE
PUBLIC_GA_TRACKING_ID= No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

PUBLIC_GA_TRACKING_ID=

WEB_CONCURRENCY=2
PUBLIC_LINE_IFTTT_APPLET_URL=https://ifttt.com/applets/VrzvihCR-cofacts-rss-line
PUBLIC_TELEGRAM_IFTTT_APPLET_URL=https://ifttt.com/applets/WRuZeP36-cofacts-rss-telegram
PUBLIC_SLACK_IFTTT_APPLET_URL=https://ifttt.com/applets/H4Sm5LDF-cofacts-rss-slack No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

PUBLIC_SLACK_IFTTT_APPLET_URL=https://ifttt.com/applets/H4Sm5LDF-cofacts-rss-slack

@@ -0,0 +1,3 @@
YOUTUBE_API_KEY=
ROLLBAR_TOKEN=
ROLLBAR_ENV=production No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

ROLLBAR_ENV=production

YOUTUBE_API_KEY=CHANGE_ME
ROLLBAR_TOKEN=CHANGE_ME
ROLLBAR_ENV=production-cofacts
ENGINE_API_KEY=CHANGE_ME No newline at end of file

Choose a reason for hiding this comment

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

medium

It's a good practice to end files with a newline character. Some tools, especially on Unix-like systems, expect text files to end with a newline and may not process the last line correctly if it's missing.

ENGINE_API_KEY=CHANGE_ME

@MrOrz
Copy link
Member Author

MrOrz commented Sep 8, 2025

@claude In docker-compose files we should point env_file entry to env-files folder, because we expect users to copy the entire env-files.sample folder to env-files and populate each env files. Please fix the docker compose files. If README is not clear with this operation, you may also amend it.

@claude
Copy link

claude bot commented Sep 8, 2025

Claude finished @MrOrz's task —— View job


Fixing docker-compose env_file paths ✅

I've successfully updated the docker-compose files to point to env-files instead of env-files.sample and improved the README instructions.

Todo List:

  • Read current docker-compose files to understand structure
  • Read README to check existing instructions
  • Update docker-compose.production.yml env_file paths
  • Update docker-compose.sample.yml env_file paths
  • Update README if needed for clarity
  • Commit and push changes

Changes Made

docker-compose.production.yml & docker-compose.sample.yml:

  • Updated all env_file paths from ./env-files.sample/ to ./env-files/
  • Fixed incorrect line-bot-sample reference to line-bot-zh in docker-compose.sample.yml

README.md:

  • Enhanced deploy steps with clearer instructions for copying env files
  • Added example bash commands showing how to copy and populate the env files

The docker-compose files now correctly expect users to copy the sample env files to an env-files directory and populate them with actual configuration values, as intended.
| Branch: claude/issue-37-20250907-0442

…ample

- Update all env_file paths in both docker-compose files from ./env-files.sample/ to ./env-files/
- Fix incorrect line-bot-sample reference to line-bot-zh in docker-compose.sample.yml
- Enhance README deploy steps with clearer instructions and example commands for copying env files

Co-authored-by: Johnson Liang <[email protected]>
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.

Use env_file instead of environment in docker-compose files

2 participants