{"id":17163139,"url":"https://github.com/isty001/dotenv-c","last_synced_at":"2025-04-13T13:31:07.051Z","repository":{"id":54937086,"uuid":"98100695","full_name":"Isty001/dotenv-c","owner":"Isty001","description":".env file parser written in C","archived":false,"fork":false,"pushed_at":"2022-12-30T22:06:51.000Z","size":34,"stargazers_count":49,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T04:51:17.499Z","etag":null,"topics":["c","dotenv","env","getenv"],"latest_commit_sha":null,"homepage":"","language":"C","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/Isty001.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":"2017-07-23T13:44:42.000Z","updated_at":"2025-03-26T05:21:46.000Z","dependencies_parsed_at":"2023-01-31T16:55:14.776Z","dependency_job_id":null,"html_url":"https://github.com/Isty001/dotenv-c","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Isty001%2Fdotenv-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Isty001%2Fdotenv-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Isty001%2Fdotenv-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Isty001%2Fdotenv-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Isty001","download_url":"https://codeload.github.com/Isty001/dotenv-c/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248721002,"owners_count":21151024,"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":["c","dotenv","env","getenv"],"created_at":"2024-10-14T22:47:54.386Z","updated_at":"2025-04-13T13:31:05.708Z","avatar_url":"https://github.com/Isty001.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## dotenv for c\n\n![Test status](https://github.com/Isty001/dotenv-c/workflows/Test/badge.svg)\n\n\nThis small package adds support for loading .env files.\nJust call the `env_load` function with a valid path, that contains a file named .env,\nor the path of the env file itself.\nIf can't be loaded, it'll return `-1`, `0` otherwise. If the second parameter is set to `true`,\nalready existing environment variable will be replaced with the new value.\n\nIn the file, comments can be added by starting the line with `#`.\nIt's also possible to nest the variables, but in that case, the used variables need be already defined.\n\nQuotes won't be removed from the strings.\n\n### Build / install\n\n##### cmake\n```\n# Build\n(mkdir -p build \u0026\u0026 cd build \u0026\u0026 \\\ncmake .. \u0026\u0026 cmake --build .)\n\n# Optional install\nsudo make install\n```\n\n|Type       | Option        | Default | Output       |\n|-----------|---------------|---------|--------------|\n|Shared     | DOTENV_SHARED | __ON__  | libdotenv.so |\n|Static     | DOTENV_STATIC | __ON__  | libdotenv-s.a|\n|Executable | DOTENV_TEST   | __OFF__ | dotenv-test  |\n\n###### Build and run test\n```\nmkdir -p build \u0026\u0026 cd build \u0026\u0026 \\\ncmake -DCMAKE_BUILD_TYPE=DEBUG -DDOTENV_TEST=ON .. \u0026\u0026 cmake --build . \u0026\u0026 \\\ncd .. \u0026\u0026 ./build/dotenv-test) \n```\n\n##### clib\nInstall via clib: `clib install Isty001/dotenv-c`, or just `git clone` into your project.\n\n\n##### make\nOr if you don't want to include in your project, you can `git clone` then install by executing `make install` then link it with `-ldotenv`.\n\n#### Usage\n```\n# DB connection\nDB_HOST=localhost\nDB_NAME=test_db\nDSN=mysql:host=${DB_HOST};dbname=${DB_NAME}\n```\n\n```c\n#include \u003cdotenv.h\u003e\n\nint main(void)\n{\n    env_load(\".\", false);\n\n    char *connection = getenv(\"DSN\");\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisty001%2Fdotenv-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisty001%2Fdotenv-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisty001%2Fdotenv-c/lists"}