{"id":21317868,"url":"https://github.com/bizon/serverless-plugin-env-stage-config","last_synced_at":"2025-07-12T02:32:56.602Z","repository":{"id":37982801,"uuid":"390427310","full_name":"bizon/serverless-plugin-env-stage-config","owner":"bizon","description":"Serverless plugin to define environment variables files for stages","archived":false,"fork":false,"pushed_at":"2025-05-26T05:20:28.000Z","size":842,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-09T12:40:20.573Z","etag":null,"topics":["environment-variables","serverless","serverless-framework","serverless-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/bizon.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,"publiccode":null,"codemeta":null}},"created_at":"2021-07-28T16:44:28.000Z","updated_at":"2025-03-16T12:34:21.000Z","dependencies_parsed_at":"2023-02-15T08:17:04.363Z","dependency_job_id":"f2b69478-b889-4faa-bed8-30030d50cf9f","html_url":"https://github.com/bizon/serverless-plugin-env-stage-config","commit_stats":{"total_commits":112,"total_committers":4,"mean_commits":28.0,"dds":0.2767857142857143,"last_synced_commit":"52ee4d04467eac913d518c31e301e0414fe216f1"},"previous_names":["bizon/serverless-plugin-stage-config"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/bizon/serverless-plugin-env-stage-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizon%2Fserverless-plugin-env-stage-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizon%2Fserverless-plugin-env-stage-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizon%2Fserverless-plugin-env-stage-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizon%2Fserverless-plugin-env-stage-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bizon","download_url":"https://codeload.github.com/bizon/serverless-plugin-env-stage-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizon%2Fserverless-plugin-env-stage-config/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264475449,"owners_count":23614284,"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":["environment-variables","serverless","serverless-framework","serverless-plugin"],"created_at":"2024-11-21T19:09:16.014Z","updated_at":"2025-07-12T02:32:56.216Z","avatar_url":"https://github.com/bizon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serverless-plugin-env-stage-config\n\n[![npm version](https://badgen.net/npm/v/serverless-plugin-env-stage-config)](https://www.npmjs.com/package/serverless-plugin-env-stage-config)\n[![XO code style](https://badgen.net/badge/code%20style/XO/cyan)](https://github.com/xojs/xo)\n\nThis [Serverless](http://www.serverless.com/) plugin allows to define environment variable configuration files for stages.\nIt exposes a new variable resolver (`$esc`) that automatically picks the correct value based on the selected stage.\nFor development stages (`local`, `dev`, `development`), the variables will default to the system’s environment variables.\n\n## CI\n\n[![Tests](https://github.com/bizon/serverless-plugin-env-stage-config/actions/workflows/tests.yml/badge.svg)](https://github.com/bizon/serverless-plugin-env-stage-config/actions/workflows/tests.yml)\n[![Release](https://github.com/bizon/serverless-plugin-env-stage-config/actions/workflows/release.yml/badge.svg)](https://github.com/bizon/serverless-plugin-env-stage-config/actions/workflows/release.yml)\n\n## Installation\n\n```sh\npnpm add -D serverless-plugin-env-stage-config\n```\n\n```yaml\nplugins:\n  - serverless-plugin-env-stage-config\n```\n\n## Usage\n\nFor non-development stages, the variables will be retrieved from a `serverless.env.${stage}.yml` file, alongside the `serverless.yml`.\n\nLet’s consider the following `serverless.yml`:\n\n```yaml\nname: my-service\n\nuseDotenv: true\n\nresources:\n  Resources:\n    MyQueue:\n      Type: AWS::SQS::Queue\n      Properties:\n        QueueName: some-queue\n\nprovider:\n  name: aws\n\n  environment:\n    MYSQL_HOST: ${esc:MYSQL_HOST}\n    MYSQL_PORT: ${esc:MYSQL_PORT}\n\nfunctions:\n  run-something:\n    handler: handler.run\n    environment:\n      QUEUE_URL: ${esc:QUEUE_URL}\n      SECRET_TOKEN: ${esc:SECRET_TOKEN}\n```\n\n## Local stages\n\nIn a local environment, the variables resolved with the `esc:` prefix will be equivalent to using `env:`. Using `useDotenv: true` alongside a `.env` file will alow you to define your environement variables.\n\nThe supported local stages are:\n\n- `local`\n- `dev`\n- `development`\n\n## Other stages\n\nIf you need to define a different source for the environement variables for your `prod` stage, you can define a `serverless.env.prod.yml` to redefine the variables.\n\nFor example, if you’re using AWS SSM Parameter Store, you could create the following file:\n\n```yaml\nMYSQL_HOST: ${ssm:/my-service/prod/MYSQL_HOST}\nQUEUE_URL: !Ref MyQueue\nSECRET_TOKEN: ${ssm:/my-service/prod/SECRET_TOKEN}\n```\n\nAny variable that is not included in the `serverless.env.prod.yml` file will produce a warning and fallback to using `env:`.\nIn this case, you will get the following warning:\n\n\u003e Serverless: env-stage-config: WARNING: the MYSQL_PORT variable is not defined in serverless.env.prod.yml, defaulting to ${env:MYSQL_PORT, null}.\n\nIf a variable is not defined in the stage environment configuration file, or the environment (`process.env`), it will default to `null`.\n\n## License\n\nMIT\n\n## Miscellaneous\n\n```\n    ╚⊙ ⊙╝\n  ╚═(███)═╝\n ╚═(███)═╝\n╚═(███)═╝\n ╚═(███)═╝\n  ╚═(███)═╝\n   ╚═(███)═╝\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizon%2Fserverless-plugin-env-stage-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbizon%2Fserverless-plugin-env-stage-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizon%2Fserverless-plugin-env-stage-config/lists"}