ardatosun / loadbalancer

Simple Go Load Balancer
MIT License
5 stars 5 forks source link

Enhance Load Balancer Configuration File Format #10

Closed ardatosun closed 1 month ago

ardatosun commented 1 month ago

Refactor the load balancer configuration file to support comments and improved readability. Consider adopting a standardized format (e.g., YAML) to enhance usability and make the configuration easier for users to understand.

Requirements:

ohyesgocool commented 1 month ago

Hi @ardatosun ,

Thanks for bringing this up. I can pick this up. But perhaps could you please explain what all the configs at least for now are we planning to migrate ? Could you point me the link to start with ?

I can do it in YAML itself , or if there is any other preference that you have , maybe we can discuss that too.

WDYT ?

Thanks,

ardatosun commented 1 month ago

Hi @ohyesgocool,

Thank you for your interest. Currently the configurations that we do/could have are:

So I was thinking to move all/some of these to a config file such as YAML, instead of hardcoding or providing via environment variables. Something like this:

backends:
  - url: http://backend1.example.com
  - url: http://backend2.example.com

health_check_interval: 30s  # Health check every 30 seconds
timeout: 2s                 # Timeout for each health check request
port: 8080                  # Port for the load balancer to listen on

Although having some of these (e.g. backend server address) as environment variables seems better to make it dynamic and to make it more production grade, I thought maybe we could move some config to yaml. At least not hardcoded in the go code.

Let me know your thoughts.

ohyesgocool commented 1 month ago

Yes got it , thanks for the detailed explanation. I’ll work on this , you can assign it to me. Thanks ,