OrlandoGolang / eps-conduit

Light-weight load balancer, written in Go
MIT License
2 stars 5 forks source link

Config filepath as command line parameter #27

Closed scottcrespo closed 8 years ago

scottcrespo commented 8 years ago

@picardrulez @etse-topps

Current Behavior

The configuration file path (eps-conduit.conf) is static, and defaults to the current working directory. As I'm working on the Vagrantfile and Chef cookbooks for the project, it creates problems when starting the app from a different working directory.

Proposed Behavior

Config file path as a command line parameter

Pretty standard have a --config parameter to specify location of the configuration file. There are plenty of use cases where the config file will not be in the current working directory.

Default config file path outside of the project directory

I recommend choosing a default file path for the config that's outside the project directory. I propose placing the file in /etc/eps-conduit.conf, following Mongo's default config file path, which is /etc/mongod.conf)

Nonetheless, we should still ship the source code with an example configuration file that users can copy into the default file path.

scottcrespo commented 8 years ago

New PR submitted, #39 can some people verify the changes work successfully?

Testing Instructions

 Disclaimer... Testing is still a manual process. I've opened up #40 to create a test framework so that new code can ship with the appropriate tests.

Scenario I. Verify Vagrant Box Provisioning

I made some changes to the Vagrant configuration. There are now 4 hello world processes running in the background, which allows us to test command-line overrides of which backends to forward requests to.

if your Vagrant box is already running...

1. Verify provisioning completed successfully

$ vagrant provision

$ vagrant ssh

2. Verify 3 Hello world processes are running

$ ps axf | grep hello

Your output should be similar to the following

vagrant@vagrant-ubuntu-trusty-64:~$ ps axf | grep hello
 6220 pts/0    S+     0:00              \_ grep --color=auto hello
 6078 ?        Sl     0:00  \_ /vagrant/bin/eps-conduit-hello --port 8004
 6082 ?        Sl     0:00  \_ /vagrant/bin/eps-conduit-hello --port 8003
 6121 ?        Sl     0:00  \_ /vagrant/bin/eps-conduit-hello --port 8001
 6125 ?        Sl     0:00  \_ /vagrant/bin/eps-conduit-hello --port 8002

Scenario II. Run without command line parameters

By running vagrant provision, the project should already be re-compiled

1. Run Conduit from Vagrant Box

$ eps-conduit

2. From a terminal window on your host OS

$ curl localhost:8000

Hello world app should respond from backends ports 8001 and 8002

Scenario III. Command line override of backend services

1. Run Conduit from Vagrant Box

$ eps-conduit -b localhost:8003,localhost:8004

2. From a terminal window on your host OS

$ curl localhost:8000

Hello world app should respond from backends ports 8003 and 8004

Scenario IV. Override other parameters

Play around with overriding configuration with the available command line parameters