TheOdinProject / odin-bot-v2

The bot that breathes life into our Discord community
ISC License
48 stars 77 forks source link

Feature: Allow Channel ID's to be overridden via `.env` #582

Closed Asartea closed 2 months ago

Asartea commented 3 months ago

Complete the following REQUIRED checkboxes:

The following checkbox is OPTIONAL:


1. Description of the Feature Request: Currently, all of the channel ID's are stored within config.js. This means that if a contributor want to test some piece of code that depends on a specific ID, the only way to do so in a personal server is to change the value there manually.

The issue with this is that config.js is a git tracked file, which means that if they forget to do undo their change before committing their changes (this is especially dangerous when you are also making an actual config change), or risk breaking production.

I propose specifying all channel ID's instead in the following format

channelNameChannelId: process.env.CHANNEL_NAME_CHANNEL_ID || <actual id>

This allows the ID to be changed by setting the right env variable in .env instead, which is kept only locally and doesn't require the make change, test, remember to undo change, forget, commit, frantically undo change, commit, force push, hope nobody merged the PR cycle.

2. Acceptance Criteria:

3. Additional Information:

MaoShizhong commented 3 months ago

This makes sense - assigned. You'll have to decide on the format for the env file for config fields containing arrays.