{"id":13629576,"url":"https://github.com/KAW0/EnvVariablesGenerator","last_synced_at":"2025-04-17T09:34:55.717Z","repository":{"id":223001517,"uuid":"758965554","full_name":"KAW0/EnvVariablesGenerator","owner":"KAW0","description":"Generate code from .env files that can be changed after build","archived":false,"fork":false,"pushed_at":"2024-03-09T17:13:10.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T10:20:17.306Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/KAW0.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-17T15:43:43.000Z","updated_at":"2024-02-21T16:01:41.000Z","dependencies_parsed_at":"2024-02-21T17:39:20.537Z","dependency_job_id":null,"html_url":"https://github.com/KAW0/EnvVariablesGenerator","commit_stats":null,"previous_names":["kaw0/envvariablesgenerator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KAW0%2FEnvVariablesGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KAW0%2FEnvVariablesGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KAW0%2FEnvVariablesGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KAW0%2FEnvVariablesGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KAW0","download_url":"https://codeload.github.com/KAW0/EnvVariablesGenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751247,"owners_count":17196594,"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":"2024-08-01T22:01:13.992Z","updated_at":"2024-11-08T20:31:17.869Z","avatar_url":"https://github.com/KAW0.png","language":"C#","readme":"# EnvVariablesGenerator\n\n`EnvVariablesGenerator` is a source generator that generates a special class called EnvVariables based on an *.env file. \nWhile there are other libraries that provide similar functionality, they often hardcode variables from the *.env file, making them less flexible.\n\nHowever, in this library, the .env **file is copied to the built project**, allowing for changes to be made to the variables from there.\n\nAdditionally, you can opt to exclude this file from the built project and allow your application to load these variables from the actual environment instead.\n\n## Instalation\nTo use add those lines in your .csproj file:\n```xml\n\u003cItemGroup\u003e\n   \u003cPackageReference Include=\"EnvVariablesGenerator\" Version=\"1.0.2\"  PrivateAssets=\"all\" /\u003e\n\u003c/ItemGroup\u003e\n\u003cItemGroup\u003e\n    \u003cAdditionalFiles Include=\"var.env\"\u003e\n        \u003cCopyToOutputDirectory\u003eAlways\u003c/CopyToOutputDirectory\u003e\n    \u003c/AdditionalFiles\u003e\n\u003c/ItemGroup\u003e\n```\nWhere `var.env` is name of your `*.env` file. Name is arbitrar except it must end with `.env`.\nAlso only one filename in project should end with `.env`\n## Example var.env file \n```\nDB_HOST=localhost\nDB_PORT=5432\n```\nUnfortunately, we cannot use a file named .env because MSBuild goes crazy when trying to add a file with just an extension as an additional file.\nAside from that, you can use whatever name you prefer, but only one file can be utilized.\n\n## Example usage\n```cs\n Console.WriteLine(EnvVariables.Host);\n Console.WriteLine(EnvVariables.Port);\n```\n## License\nThis library is licensed under the MIT License.\n","funding_links":[],"categories":["Source Generators","Do not want to test 112 ( old ISourceGenerator )"],"sub_categories":["Statically typed resources / configurations","1. [ThisAssembly](https://ignatandrei.github.io/RSCG_Examples/v2/docs/ThisAssembly) , in the [EnhancementProject](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#enhancementproject) category"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKAW0%2FEnvVariablesGenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKAW0%2FEnvVariablesGenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKAW0%2FEnvVariablesGenerator/lists"}