dpouris / goster

🐹 Goster is a Go package to help you make micro-services and API's
MIT License
13 stars 0 forks source link

Enhance Engine Configuration #9

Open dpouris opened 3 months ago

dpouris commented 3 months ago

The TemplateDir function currently allows the user to set new file paths for the engine to look for static files. However, the BaseStaticDir property in Engine.Config.BaseStaticDir is only defined in the call to the DefaultConfig function, which is executed once during initialization. This limitation prevents users from dynamically customizing the BaseStaticDir or other engine configuration settings after initialization. To provide greater flexibility and control, we need to enhance the behavior to allow users to customize BaseStaticDir and other engine configurations after initialization.

Goals:

  1. Dynamic Configuration:
    • Allow users to customize BaseStaticDir and other engine configurations after initialization.

Tasks:

  1. Add NewConfig:

    • Add NewConfig function to allow for custom BaseStaticDir and other configuration properties after initialization of Engine.
    • Ensure the function can be safely called multiple times without causing inconsistencies.
  2. Implement Config Update Mechanism:

    • Provide methods to update engine configuration properties dynamically.
    • Ensure these methods are thread-safe and validate the new configuration values.
  3. Update Documentation:

    • Update the documentation to reflect the new configuration capabilities.
    • Provide examples of how to dynamically update BaseStaticDir and other configurations.
  4. Develop Tests:

    • Write comprehensive tests to cover the dynamic configuration updates.
    • Ensure tests validate both successful updates and appropriate error handling for invalid configurations.

Impact: Enhancing the ability to customize BaseStaticDir and other engine configurations at runtime will provide greater flexibility and control to users of the package. It will allow for more dynamic and adaptable application setups, improving the overall usability and robustness of the framework.

Priority: Medium-High

Estimated Effort: Medium

Dependencies:

Next Steps:

  1. Add the NewConfig function to support dynamic updates.
  2. Implement a mechanism for dynamic configuration updates to Engine.
  3. Update the documentation with new examples.
  4. Develop and run tests to ensure the new functionality works as expected.