efdevcon / streameth

This repo has been moved
https://github.com/streamethorg/streameth-platform
51 stars 10 forks source link

Load Config from Environment Variables and Improve Deployment Flexibility #14

Closed pblvrt closed 1 year ago

pblvrt commented 1 year ago

This PR implements a change in the way Streameth loads the config object, moving from a hardcoded JSON file to environment variables. The main changes include:

  1. Refactoring the EventController class to ConfigController to better reflect the purpose of the class, as it deals with general configuration rather than just event-specific information.

  2. Updating the getConfig() method within the ConfigController to load configuration values from environment variables instead of a static JSON file, allowing for more flexible configuration management.

  3. Adding validation functions in the ConfigController to ensure the configuration object adheres to the required structure and properties. The validation functions check for the presence of required properties, validate the Data interface, and ensure the data.type property is one of the allowed enum values. If any issues are found in the configuration, an appropriate error message is thrown.

    These changes provide a more robust and type-safe approach to handling configuration within Streameth. By loading the config object from environment variables, deployments become more flexible, allowing for direct deployment of Streameth instances with different configurations by simply modifying the environment variables in the organization's hosting service. This eliminates the need to fork Streameth for each new configuration and streamlines the deployment process.

netlify[bot] commented 1 year ago

Deploy Preview for flourishing-genie-b0f707 failed.

Name Link
Latest commit b1b372fc4856790135dfaf011cab69e970d12282
Latest deploy log https://app.netlify.com/sites/flourishing-genie-b0f707/deploys/64341b76a7e017000866ed97
netlify[bot] commented 1 year ago

Deploy Preview for streameth failed.

Name Link
Latest commit b1b372fc4856790135dfaf011cab69e970d12282
Latest deploy log https://app.netlify.com/sites/streameth/deploys/64341b768e421b0008987f96
wslyvh commented 1 year ago

I'm ok to merge. For now. As I can see deployment/forking becomes easier. I'm not fully convinced this is the right approach long term though. We need to think about a better way to manage event / configuration settings.

Especially if you want to manage multiple years/editions for the same event (e.g. 2022, 2023, etc..) env variables will be too limiting for that, imo