Implement the ability to read configuration from a file
jzoldak opened this issue · comments
There are a few OS environment variables that control the behavior of pip-accel: 'PIP_ACCEL_CACHE', 'PIP_DOWNLOAD_CACHE', 'PIP_ACCEL_S3_BUCKET', 'PIP_ACCEL_S3_PREFIX', 'PIP_ACCEL_AUTO_INSTALL'.
It would be great if there was the option of reading these values out of configuration file as well.
My use case: I am creating jenkins worker AMIs via a jenkins job that uses Packer to trigger an ansible script.
Just to get this working, I'm using not setting the CACHE vars and I've hard coded the values for the PIP_ACCEL_S3_ env vars. I know, it's awful!
I'm doing this because there are too many levels of indirection for this to work easily otherwise. I can pass OS environment variables to the shell command that runs the play, but that doesn't flow through to the command that is run on the remote AMI as the worker is being built. More detailed info here.
This could probably be sorted out, but it would be much more straightforward if I could instead just write out a config file via a template, like I am for boto.
Perhaps instead of current implementation, config could be refactored to create a configuration object. Then it would be easier to set the values either via a config file or as extra vars on the command line.
UPDATE:
Note that the links above are now obsolete, as they point to a branch which now has subsequent commits and will probably be deleted in the future after merging into master.
I just published pip-accel 0.17 which adds initial* support for configuration files. I still need to update the readme, but in the mean time you can find the details without source code diving by checking the updated documentation. I hope this works for you, let me know what you think.
* I may still change some things, but let's first see how this works :-)
Nice refactor. 😻