{"id":33190825,"url":"https://github.com/mathworks/dotenv-for-MATLAB","last_synced_at":"2025-11-21T00:02:17.533Z","repository":{"id":43137920,"uuid":"235416947","full_name":"mathworks/dotenv-for-MATLAB","owner":"mathworks","description":"Load environment variables from a .env file.","archived":false,"fork":false,"pushed_at":"2022-07-08T17:46:49.000Z","size":230,"stargazers_count":15,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-30T12:16:48.897Z","etag":null,"topics":["dotenv","matlab"],"latest_commit_sha":null,"homepage":null,"language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-21T18:51:16.000Z","updated_at":"2024-10-01T00:09:18.000Z","dependencies_parsed_at":"2022-09-05T06:40:59.706Z","dependency_job_id":null,"html_url":"https://github.com/mathworks/dotenv-for-MATLAB","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mathworks/dotenv-for-MATLAB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2Fdotenv-for-MATLAB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2Fdotenv-for-MATLAB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2Fdotenv-for-MATLAB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2Fdotenv-for-MATLAB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathworks","download_url":"https://codeload.github.com/mathworks/dotenv-for-MATLAB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks%2Fdotenv-for-MATLAB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285532343,"owners_count":27187706,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dotenv","matlab"],"created_at":"2025-11-16T06:00:40.184Z","updated_at":"2025-11-21T00:02:17.528Z","avatar_url":"https://github.com/mathworks.png","language":"MATLAB","readme":"# dotenv for MATLAB\n\n\u003e A MATLAB implementation of dotenv\n\nStoring [configuration in the environment](https://12factor.net/config) is one of the tenets of a [12-factor app](https://12factor.net/). dotenv for MATLAB\u0026reg; lets you store configuration data (passwords, API keys, server names, etc.) outside of your code. This lets you share your code without sharing your configuration data.\n\n![screenshot](config/dotenv-compare.png \"MATLAB Screenshot\")\n\n[![mathworks](https://circleci.com/gh/mathworks/dotenv-for-MATLAB.svg?style=shield)](https://circleci.com/gh/mathworks/dotenv-for-MATLAB)\n\n[![View dotenv-for-MATLAB on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/73988-dotenv-for-matlab)\n\n## Installation\n\nPut `dotenv.m` somewhere on your [search path](https://www.mathworks.com/help/matlab/ref/path.html).\n\n## Usage Example\n\n`dotenv()` will try and load a file named `.env` from the current working folder. Alternatively, you can specify the path with `dotenv('path/to/file.env')`.\n\n`.env`\n\n```perl\n# Obligatory XKCD https://xkcd.com/936/\npassword=correct-horse-battery-staple \n```\n\n`file.m`\n\n```matlab\nd = dotenv();\nopts = weboptions('HeaderField', [\"accept\", \"any\"; \"authorization\", d.env.password])\nurl = \"https://myurl.com\"\nresponse = webread(url, opts);\n```\n\nCommon places you may need to do this are [`weboptions()`](https://www.mathworks.com/help/matlab/ref/weboptions.html), [working with remote data like S3 buckets](https://www.mathworks.com/help/matlab/import_export/work-with-remote-data.html), the [Database Toolbox](https://www.mathworks.com/help/database/ug/database.odbc.connection.html), or [`ftp()`](https://www.mathworks.com/help/matlab/ref/ftp.html).\n\n## Rules\n\nThe parsing engine currently supports the following rules:\n\n* empty lines are skipped\n* lines beginning with `#` are treated as comments\n* empty values become empty strings (`DB_HOST=` becomes `DBHOST: ''`)\n* whitespace is removed from both ends of unquoted values (`DB_HOST=some server` becomes `DB_HOST:'some server'`)\n* quoted values are escaped (`DB_PASS=\" some password \"` becomes `DB_PASS:' some password '`)\n\nExamples are in the [config](config/) directory.\n\n## FAQ\n\n### Should I commit my `.env` file?\n\nNo. You should put `*.env` in your `.gitignore` file. [MATLAB.gitignore](https://github.com/mathworks/gitignore/blob/main/Global/MATLAB.gitignore) plus `*.env` is a good start.\n\n## Development Setup\n\nClone the repository. You can run `runtests('tests')` from the project root to run the [unit test suite](tests/).\n\n## Bugs?\n\nI would love to hear if this breaks on any weird strings or doesn't work the way you expected.\n","funding_links":[],"categories":["Database Management"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Fdotenv-for-MATLAB","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathworks%2Fdotenv-for-MATLAB","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks%2Fdotenv-for-MATLAB/lists"}