useenv


Nameuseenv JSON
Version 0.4.0 PyPI version JSON
download
home_page
Summary
upload_time2023-11-15 15:27:54
maintainer
docs_urlNone
authorYour Name
requires_python>=3.10,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # useenv

A tiny tool to manage values in your env file. 
Useful in some rare circumstances e.g. swapping variables in local development,
when you don't want to maintain multiple separate env files.  

* `pipx install useenv`
* Create a `.useenv.yml` config file in your project root. 
  * If this contains secret values then make sure to add `.useenv.yml` to your project or global `.gitignore`.
* `useenv <env_identifier>`

Example `.useenv.yml` config file:

```yml
env_file: .env
envs:
    foo:
        DATABASE_HOST: foo-host
        DATABASE_USER: foo-user
        DATABASE_PASSWORD: foo-pw
    bar:
        DATABASE_HOST: bar-host
        DATABASE_USER: bar-user
        DATABASE_PASSWORD: bar-pw
```


## Modes

`--mode` flag or `mode` field of the config.

### `merge` (default)

Values will be merged into the existing env file.

### `create`

Env file will be created/overwritten.

In this case you may want to define a common set of values. YAML gives us the tools to do this:

```yml
_common: &common
    DATABASE_USER: common-user
  
env_file: .env
mode: create
envs:
    foo:
        << : *common
        DATABASE_HOST: foo-host    
        DATABASE_PASSWORD: foo-pw
    bar:
        << : *common
        DATABASE_HOST: bar-host    
        DATABASE_PASSWORD: bar-pw
```

## 1password

If you have the 1password CLI installed then you can pull values from 1password:

```yml
...
envs:
    foo:
        DATABASE_PASSWORD: 1pw::<item-id>::<field>  # e.g. 1pw::abcdefqwerty::password
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "useenv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/a6/80/3ab72bdf895a98fb2d922e2c3b3dc1ca6aba31d9174927c951c490f14701/useenv-0.4.0.tar.gz",
    "platform": null,
    "description": "# useenv\n\nA tiny tool to manage values in your env file. \nUseful in some rare circumstances e.g. swapping variables in local development,\nwhen you don't want to maintain multiple separate env files.  \n\n* `pipx install useenv`\n* Create a `.useenv.yml` config file in your project root. \n  * If this contains secret values then make sure to add `.useenv.yml` to your project or global `.gitignore`.\n* `useenv <env_identifier>`\n\nExample `.useenv.yml` config file:\n\n```yml\nenv_file: .env\nenvs:\n    foo:\n        DATABASE_HOST: foo-host\n        DATABASE_USER: foo-user\n        DATABASE_PASSWORD: foo-pw\n    bar:\n        DATABASE_HOST: bar-host\n        DATABASE_USER: bar-user\n        DATABASE_PASSWORD: bar-pw\n```\n\n\n## Modes\n\n`--mode` flag or `mode` field of the config.\n\n### `merge` (default)\n\nValues will be merged into the existing env file.\n\n### `create`\n\nEnv file will be created/overwritten.\n\nIn this case you may want to define a common set of values. YAML gives us the tools to do this:\n\n```yml\n_common: &common\n    DATABASE_USER: common-user\n  \nenv_file: .env\nmode: create\nenvs:\n    foo:\n        << : *common\n        DATABASE_HOST: foo-host    \n        DATABASE_PASSWORD: foo-pw\n    bar:\n        << : *common\n        DATABASE_HOST: bar-host    \n        DATABASE_PASSWORD: bar-pw\n```\n\n## 1password\n\nIf you have the 1password CLI installed then you can pull values from 1password:\n\n```yml\n...\nenvs:\n    foo:\n        DATABASE_PASSWORD: 1pw::<item-id>::<field>  # e.g. 1pw::abcdefqwerty::password\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c2049ca8b61258564b0c545a7560d3f0ee0902b53bfe8c22f4ddb91f6c2344d9",
                "md5": "605131d3102817459bcff7d6d04a2dc6",
                "sha256": "ccf123d93a6ebcdc785d3f3a4859087a55d234d546a01713a7a4c8e4c128f90f"
            },
            "downloads": -1,
            "filename": "useenv-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "605131d3102817459bcff7d6d04a2dc6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 3055,
            "upload_time": "2023-11-15T15:27:52",
            "upload_time_iso_8601": "2023-11-15T15:27:52.937161Z",
            "url": "https://files.pythonhosted.org/packages/c2/04/9ca8b61258564b0c545a7560d3f0ee0902b53bfe8c22f4ddb91f6c2344d9/useenv-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6803ab72bdf895a98fb2d922e2c3b3dc1ca6aba31d9174927c951c490f14701",
                "md5": "413534d9095fb0108104876bce3c2456",
                "sha256": "26fdf83250cac1b0f6bc058b504bc20d018d215af8a4a69b112d50fb46379a28"
            },
            "downloads": -1,
            "filename": "useenv-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "413534d9095fb0108104876bce3c2456",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 2584,
            "upload_time": "2023-11-15T15:27:54",
            "upload_time_iso_8601": "2023-11-15T15:27:54.409172Z",
            "url": "https://files.pythonhosted.org/packages/a6/80/3ab72bdf895a98fb2d922e2c3b3dc1ca6aba31d9174927c951c490f14701/useenv-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-15 15:27:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "useenv"
}
        
Elapsed time: 0.20586s