Skip to content

Commit

Permalink
Merge pull request #51 from diasjorge/fix-invalid-environment-variable
Browse files Browse the repository at this point in the history
Replace non word characters in environment key
  • Loading branch information
russell-lewis authored Mar 22, 2017
2 parents 32e4f4b + 95693c4 commit e8af1ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bless/config/bless_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ConfigParser
import base64
import os
import re

BLESS_OPTIONS_SECTION = 'Bless Options'
CERTIFICATE_VALIDITY_BEFORE_SEC_OPTION = 'certificate_validity_before_seconds'
Expand Down Expand Up @@ -145,4 +146,4 @@ def get(self, section, option):

@staticmethod
def _environment_key(section, option):
return (section.replace(' ', '_') + '_' + option).lower()
return (re.sub('\W+', '_', section) + '_' + re.sub('\W+', '_', option)).lower()
2 changes: 1 addition & 1 deletion tests/config/test_bless_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_config_environment_override(monkeypatch):
'bless_options_logging_level': 'DEBUG',
'bless_options_certificate_extensions': 'permit-X11-forwarding',

'bless_ca_us-east-1_password': '<INSERT_US-EAST-1_KMS_ENCRYPTED_BASE64_ENCODED_PEM_PASSWORD_HERE>',
'bless_ca_us_east_1_password': '<INSERT_US-EAST-1_KMS_ENCRYPTED_BASE64_ENCODED_PEM_PASSWORD_HERE>',
'bless_ca_default_password': '<INSERT_DEFAULT_KMS_ENCRYPTED_BASE64_ENCODED_PEM_PASSWORD_HERE>',
'bless_ca_ca_private_key_file': '<INSERT_YOUR_ENCRYPTED_PEM_FILE_NAME>',
'bless_ca_ca_private_key': base64.b64encode('<INSERT_YOUR_ENCRYPTED_PEM_FILE_CONTENT>'),
Expand Down

0 comments on commit e8af1ca

Please sign in to comment.