{"id":28312806,"url":"https://github.com/mrzstack/environment-variable-updater","last_synced_at":"2025-06-23T11:31:28.799Z","repository":{"id":252338161,"uuid":"840134243","full_name":"mrzstack/environment-variable-updater","owner":"mrzstack","description":"Environment Variable Updater | Shell Script - Add in your project to main tain two .env for local and server","archived":false,"fork":false,"pushed_at":"2024-08-09T04:20:31.000Z","size":237,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T04:41:52.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrzstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-09T03:37:07.000Z","updated_at":"2024-08-09T04:20:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"53fa8958-836c-4fc0-bc76-cacc7403a72e","html_url":"https://github.com/mrzstack/environment-variable-updater","commit_stats":null,"previous_names":["jmrashed/environment-variable-updater","mrzstack/environment-variable-updater"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrzstack/environment-variable-updater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrzstack%2Fenvironment-variable-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrzstack%2Fenvironment-variable-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrzstack%2Fenvironment-variable-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrzstack%2Fenvironment-variable-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrzstack","download_url":"https://codeload.github.com/mrzstack/environment-variable-updater/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrzstack%2Fenvironment-variable-updater/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261469174,"owners_count":23163038,"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-05-24T17:11:19.826Z","updated_at":"2025-06-23T11:31:28.783Z","avatar_url":"https://github.com/mrzstack.png","language":"Shell","readme":"# Environment Variable Updater\n\n![GitHub](https://img.shields.io/github/license/jmrashed/environment-variable-updater)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/jmrashed/environment-variable-updater)\n![GitHub last commit](https://img.shields.io/github/last-commit/jmrashed/environment-variable-updater)\n![GitHub issues](https://img.shields.io/github/issues/jmrashed/environment-variable-updater)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/jmrashed/environment-variable-updater)\n![GitHub contributors](https://img.shields.io/github/contributors/jmrashed/environment-variable-updater)\n\n![Environment Variable Updater](https://github.com/jmrashed/environment-variable-updater/blob/main/assets/directory-and-files.png)\n\n\n\n## Introduction\n\nThe Environment Variable Updater is a shell script designed to streamline the process of updating environment variables in a `.env` file based on a given source file. This tool is particularly useful for managing environment-specific configurations in development and production setups.\n\n## Contents\n\n- [Environment Variable Updater](#environment-variable-updater)\n  - [Introduction](#introduction)\n  - [Contents](#contents)\n  - [How It Works](#how-it-works)\n  - [Why We Should Use This](#why-we-should-use-this)\n  - [How to Install with Existing Project](#how-to-install-with-existing-project)\n  - [Requirements](#requirements)\n  - [Files Required](#files-required)\n  - [How to Ensure Permissions](#how-to-ensure-permissions)\n  - [How to Run with Parameters](#how-to-run-with-parameters)\n  - [Contributions](#contributions)\n  - [Author Info](#author-info)\n\n## How It Works\n\n1. **Folder Check:** The script verifies that it is executed from a directory containing the `environment-variable-updater` folder.\n2. **Argument Validation:** It checks for the required argument (`local` or `server`) to determine which environment file to use.\n3. **File Selection:** Based on the argument, the script selects the appropriate environment file (`.env.local` or `.env.server`).\n4. **Backup and Create `.env`:** The script backs up the existing `.env` file if present, or creates a new one if it does not exist.\n5. **Update or Append Variables:** The script reads the selected environment file, updates existing variables in the `.env` file, or appends new ones as needed.\n6. **Replacement:** The original `.env` file is replaced with the updated content from a temporary file.\n\n## Why We Should Use This\n\n- **Consistency:** Ensures that environment variables are consistent and up-to-date across different environments.\n- **Automation:** Automates the process of updating environment variables, reducing manual effort and potential errors.\n- **Backup:** Automatically creates backups of the existing `.env` file to prevent data loss.\n\n## How to Install with Existing Project\n\n1. **Clone the Repository:**\n\n   ```sh\n   git clone git@github.com:jmrashed/environment-variable-updater.git\n   ```\n\n2. **Navigate to the Directory:**\n\n   ```sh\n   cd environment-variable-updater\n   ```\n\n3. **Ensure the Script is Executable:**\n\n   ```sh\n   chmod +x update-env.sh\n   ```\n\n## Requirements\n\n- A Unix-like operating system (Linux, macOS)\n- `bash` shell\n- Basic Unix utilities (`grep`, `sed`, `cut`, `mv`)\n\n## Files Required\n\n- **`.env`:** The environment file to be updated.\n- **`environment-variable-updater/.env.local`:** Environment variables for the local setup.\n- **`environment-variable-updater/.env.server`:** Environment variables for the server setup.\n- **`environment-variable-updater/update-env.sh`:** The script to update the `.env` file.\n\n## How to Ensure Permissions\n\nEnsure that the `update-env.sh` script is executable. You can set the appropriate permissions using:\n\n```sh\nchmod +x environment-variable-updater/update-env.sh\n```\n\n## How to Run with Parameters\n\nTo update the `.env` file using the `local` configuration:\n\n```sh\n./environment-variable-updater/update-env.sh local\n```\n\nTo update the `.env` file using the `server` configuration:\n\n```sh\n./environment-variable-updater/update-env.sh server\n```\n\n## Contributions\n\nContributions are welcome! If you have suggestions, improvements, or bug fixes, please submit a pull request or open an issue in the repository.\n\n## Author Info\n\n- **Name:** Md Rasheduzzaman\n- **Position:** Tech Lead at Onesttech LLC\n- **Email:** [jmrashed@gmail.com](mailto:jmrashed@gmail.com)\n- **Whatsapp:** +8801734446514\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrzstack%2Fenvironment-variable-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrzstack%2Fenvironment-variable-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrzstack%2Fenvironment-variable-updater/lists"}