{"id":25543925,"url":"https://github.com/josephp27/e2yaml","last_synced_at":"2026-02-07T10:30:18.802Z","repository":{"id":57424907,"uuid":"208636538","full_name":"josephp27/E2Yaml","owner":"josephp27","description":"An environment variable to yaml converter","archived":false,"fork":false,"pushed_at":"2020-09-22T04:55:29.000Z","size":62,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T03:18:27.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josephp27.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-15T18:13:51.000Z","updated_at":"2023-04-28T22:14:54.000Z","dependencies_parsed_at":"2022-09-13T15:23:00.697Z","dependency_job_id":null,"html_url":"https://github.com/josephp27/E2Yaml","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephp27%2FE2Yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephp27%2FE2Yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephp27%2FE2Yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephp27%2FE2Yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephp27","download_url":"https://codeload.github.com/josephp27/E2Yaml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800273,"owners_count":19699118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-20T07:39:47.255Z","updated_at":"2026-02-07T10:30:18.726Z","avatar_url":"https://github.com/josephp27.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E2Yaml [![Downloads](https://pepy.tech/badge/e2yaml)](https://pepy.tech/project/e2yaml) [![Downloads](https://pepy.tech/badge/e2yaml/month)](https://pepy.tech/project/e2yaml/month) [![Downloads](https://pepy.tech/badge/e2yaml/week)](https://pepy.tech/project/e2yaml/week)\r\nAn environment variable to yaml converter. \r\n\r\n## Purpose\r\nDue to security reasons at my job, we cannot upload contents of Yaml files that have sensitive data. Variables are injected into a virtual environment as environment variables via a Jenkins job. However, when testing locally, sometimes we need those variables. E2Yaml addresses that problem.\r\n\r\n```\r\nSPRING_DATA_MONGODB_DATABASE: TESTDB\r\nSPRING_DATA_MONGODB_ENCRYPTION: disabled\r\nSPRING_DATA_MONGODB_ENCRYPTION-KEY: FakePassWord!\r\nSPRING_DATA_MONGODB_PASSWORD: !54353Ffesf34\r\nSPRING_DATA_MONGODB_REPLICASET: FAKE-DB-531\r\n```\r\nConverts to:\r\n```yml\r\nspring:\r\n  data:\r\n    mongodb:\r\n      database: TESTDB\r\n      encryption: disabled\r\n      encryption-key: \"FakePassWord!\"\r\n      password: \"!54353Ffesf34\"\r\n      replicaSet: FAKE-DB-531\r\n```\r\n And we can see this from the command line by runnning driver.py:\r\n \r\n ```\r\n ╰─$ python3 driver.py\r\nPARSING: \tSPRING_DATA_MONGODB_DATABASE: TESTDB\tOK\r\nPARSING: \tSPRING_DATA_MONGODB_ENCRYPTION: disabled\tOK\r\nPARSING: \tSPRING_DATA_MONGODB_ENCRYPTION-KEY: FakePassWord!\tOK\r\nPARSING: \tSPRING_DATA_MONGODB_PASSWORD: !54353Ffesf34\tOK\r\nPARSING: \tSPRING_DATA_MONGODB_REPLICASET: FAKE-DB-531\tOK\r\n ```\r\n## Installing\r\nFrom bash run the line below\r\n```bash\r\npip install E2Yaml\r\n```\r\nThis project is published on pip at: https://pypi.org/project/E2Yaml/\r\n## Importing\r\n```bash\r\nimport E2Yaml as ey\r\n```\r\n\r\n## Loading\r\n```python\r\n# example program loading from clipboard and outputting to clipboard\r\nyml = ey.from_clipboard(log=True, separate=True)\r\n\r\n# converting a file\r\nyml = ey.load_file('test_input.env', log=True)\r\n\r\n# adding one line at a time\r\nyml = EyConverter().add_line(\"SOME_TEXT=true\")\r\n```\r\nNote: you can disable logging by not including the second parameter *log=True* and provide better output spacing with *separate=True*\r\n\r\n## Preserving Words\r\nEnvironment variables are delimited by '_' to indicate nesting in YAML and sometimes these characters are also used to define a variable. You can choose to preserve the letters by calling this function\r\n```python\r\nyml.preserve_words('auditLog',\r\n                    'logInsertsEnabled',\r\n                    'kafkaEnabled',\r\n                    'tibcoPublishes',\r\n                    'tibcoSubscriptions',\r\n                    'queue_connection_factory',\r\n                    'inbound_queue',\r\n                    'outbound_queue',\r\n                    'retry_queue',\r\n                    'pkt_dead_letter_queue',\r\n                    'idle_concurrent',\r\n                    'max_concurrent',\r\n                    'connection_timeout',\r\n                    'connection_attempts',\r\n                    'reconnection_timeout',\r\n                    'reconnection_attempts',\r\n                    'replicaSet')\r\n```\r\nNote: environment variables are usually upper case and camel case is lost in translation. To preserve this, you can add the variable above as well.\r\n\r\n## Ignoring Lines\r\nIf you're loading in from a file or from your clipboard, you can ignore specific lines containing an attribute.\r\n```python\r\nyml.ignore_lines_containing('JAVA_OPTS', 'CONVEYOR')\r\n```\r\n\r\n## Converting\r\nFirst, you need to call the function *convert_to_dictionary()*, which returns itself, allowing chaining. Then, setting the proper output to clipboard, stdout, or a file.\r\n```python\r\n# in this case we are writing to the clipboard.\r\nyml.convert_to_dictionary().to_clipboard()\r\n\r\n# print to stdout\r\nyml.convert_to_dictionary().show()\r\n\r\n# print to file\r\nyml.convert_to_dictionary().write_file('filename.yml'))\r\n```\r\n\r\n## Examples\r\ndriver.py is an example program to write to read from the clipboard and writes back for easy copying and pasting\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephp27%2Fe2yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephp27%2Fe2yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephp27%2Fe2yaml/lists"}