{"id":20145424,"url":"https://github.com/cuongnb14/format-env","last_synced_at":"2025-03-03T00:13:09.266Z","repository":{"id":256930860,"uuid":"856818980","full_name":"cuongnb14/format-env","owner":"cuongnb14","description":"Format env is a Go command-line utility to generate and format environment files (.env) using a template","archived":false,"fork":false,"pushed_at":"2024-09-14T08:29:46.000Z","size":1871,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T10:51:53.051Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/cuongnb14.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-09-13T09:09:01.000Z","updated_at":"2024-09-14T08:29:49.000Z","dependencies_parsed_at":"2025-01-13T10:45:50.152Z","dependency_job_id":"ec32669f-6dbf-4b59-a5a9-c03a2822ad69","html_url":"https://github.com/cuongnb14/format-env","commit_stats":null,"previous_names":["cuongnb14/format-env"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongnb14%2Fformat-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongnb14%2Fformat-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongnb14%2Fformat-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuongnb14%2Fformat-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuongnb14","download_url":"https://codeload.github.com/cuongnb14/format-env/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241587853,"owners_count":19986628,"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-11-13T22:16:38.294Z","updated_at":"2025-03-03T00:13:09.248Z","avatar_url":"https://github.com/cuongnb14.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Format env\nformat-env is a Go command-line utility to generate and format environment files (.env) using a template. This tool allows you to specify the environment (e.g., dev, testing, staging, etc.) and a template file to generate the corresponding environment configuration file.\n\n# Features\n- Reads key-value pairs from an existing .env file.\n- Applies the values to a template for formatting.\n- Supports multiple stages (dev, testing, unstable, staging).\n- Allows specifying the template path and stage dynamically through command-line arguments.\n\n# Installation\n## Option 1: Donwload binary file\n```sh\n# for macos arm64 \nwget https://github.com/cuongnb14/format-env/releases/download/v1.0.1/fenv_darwin_arm64 -O fenv\nsudo mv fenv /usr/local/bin/\nsudo chmod +x /usr/local/bin/fenv\n```\n\n## Option 2: Compile from source\nTo build and install the utility, make sure you have Go installed, and then run:\n```\ngo build -o fenv fenv.go\n```\n\nMove the binary to your $PATH for easy access:\n```\nsudo mv fenv /usr/local/bin/\nsudo chmod +x /usr/local/bin/fenv\n```\n# Usage\n\nTo use the utility, run it from the command line by specifying the template file and the environment stage you want to generate.\n```\nfenv \u003cenv_dir\u003e \u003cstages\u003e\n```\n- env_dir: Path to the env dir (e.g., `env/`). The template file name `_template.env` must have in this folder\n- stages: The environment stage, separate by comma (e.g. `dev,testing,staging`).\n\nExample\n```\n| env\n|--- _template.env\n|--- dev.env\n|--- staging.env\n|--- prod.env\n\n# run format\nfenv env/ dev,staging,prod\n```\n# Template Syntax\nThe template file should use Go’s text/template syntax. For example:\n```\n# General\n# =======================================================================\nSTAGE={{ .STAGE }}\nPORT={{ df .PORT \"8000\" }}\n\n# Database\n# =======================================================================\nDB_HOST={{ .DB_HOST }}\nDB_PORT={{ .DB_PORT }}\nDB_USER={{ .DB_USER }}\nDB_PASS={{ .DB_PASS }}\nDB_NAME={{ df .DB_NAME \"example\" }}\n\n# Redis\n# =======================================================================\nREDIS_ENABLE_SSL={{ df .REDIS_ENABLE_SSL \"false\" }}\nREDIS_URL={{ .REDIS_URL }}\n```\nNote: This template will render the environment variable `REDIS_ENABLE_SSL` and use a default value `false` if it is not provided.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuongnb14%2Fformat-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuongnb14%2Fformat-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuongnb14%2Fformat-env/lists"}