DiffSK / configobj

Python 3+ compatible port of the configobj library
https://configobj.readthedocs.org
Other
322 stars 76 forks source link

Support for loading config object from "<(/usr/bin/envsubst < template)" #187

Open LucidOne opened 5 years ago

LucidOne commented 5 years ago

configobj has an issue being passed a file descriptor (/dev/fd) via process substitution.

os.path.isfile("/dev/fd/{{ anything }}") returns False for file descriptors while os.path.exists() returns True.

test.py

#!/usr/bin/python
import sys
import configobj

print configobj.ConfigObj(sys.argv[1])

I'll update the PR with a test when I get a chance

$ cat foo.ini 
shell = /bin/bash
$ cat bar.ini.template 
shell = $SHELL
$ ./test.py foo.ini 
{'shell': '/bin/bash'}
$ ./test.py <(envsubst < bar.ini.template )
{'shell': '/bin/bash'}

This is needed in cloud environments where you may not want to store passwords on disk in an unencrypted form or have variables passed into a container environment.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-47.9%) to 33.926% when pulling ae4b6ab17d9ae6878a77b898018fa9edd60bbc81 on LucidOne:process_substitution into 45fbf1b85b181853caea4d251e6d4c0232735e85 on DiffSK:master.

LucidOne commented 5 years ago

I'm not sure why coverage dropped, but it looks like the tests work. Let me know if you have any other feedback.

LucidOne commented 5 years ago

Is there anything left to get this merged?

LucidOne commented 5 years ago

Any update on this?

LucidOne commented 4 years ago

Is it possible to get this merged? I'd like to improve the letsencrypt certbot docker container for doing dns based wildcard cert requests and this is blocking me.

LucidOne commented 1 year ago

Would it help to rebase this?