Metadata-Version: 2.4
Name: swenv
Version: 1.0.1
Summary: Switch system and application settings based on the detected network environment.
Author-email: Sébastien Hocquet <seb@ipamo.net>
Project-URL: Homepage, https://gitlab.com/ipamo/swenv
Project-URL: Bug Tracker, https://gitlab.com/ipamo/swenv
Keywords: environment,env,linux,workstation,station,switch
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9.2
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Dynamic: license-file

Swenv
======

Switch system and application settings based on the detected network environment.


## Quick start

Prerequisites: Python (version >= 3.9.2)
- [Download for Windows](https://www.python.org/downloads/)
- Install on Linux Debian / Ubuntu: `sudo apt install python3`

To install using the [published PyPI package](https://pypi.org/project/swenv/), run:

    pip install swenv
    swenv configure

To install from the [source repositority](https://gitlab.com/ipamo/swenv.git), run:

    git clone https://gitlab.com/ipamo/swenv.git
    cd swenv
    python -m swenv configure

The application can then be executed directly. Example:

    swenv

To view available options, run:

    swenv --help


## Configuration

Configuration directory is located at `APPDATA\Roaming\swenv` in your Windows home (or in `~/.local/share/swenv` if you use Linux).

An environment is configured using a JSON file in the configuration directory. Example for an environment named `mycompany` (configuration file `APPDATA\Roaming\swenv\mycompany.json` on Windows or `~/.local/share/swenv/mycompany.json` on Linux):

```json
{
    "dns_servers": [
        "10.0.0.1",
        "10.0.0.2",
    ],

    "proxy_host": "proxy.mycompany.local",
    "proxy_port": 3128,
    "proxy_cafile": "ca-certificates/mycompany-ca-proxy.crt",
    "no_proxy": "10.*,192.168.*,172.16.*,172.17.*,172.18.*,172.19.*,172.20.*,172.21.*,172.22.*,172.23.*,172.24.*,172.25.*,172.26.*,172.27.*,172.28.*,172.29.*,172.30.*,172.31.*,127.*,130.93.17.229,localhost,mycompany.local",

    "apt_repositories": {
        "root": "http://nexus.mycompany.local/repository",
        "http://deb.debian.org/debian": {
            "bookworm": "debian-bookworm",
            "bookworm-updates": "debian-bookworm-updates",
            "bookworm-backports": "debian-bookworm-backports"
        },
        "http://security.debian.org/debian-security": {
            "bookworm-security": "debian-bookworm-security"
        },
        "https://download.docker.com/linux/debian": {
            "bookworm": "debian-bookworm-docker"
        },
        "https://deb.nodesource.com/node_20.x": {
            "nodistro": "nodesource-20.x"
        },
        "https://packagecloud.io/timescale/timescaledb/debian": {
            "bookworm": "timescaledb-bookworm"
        },
        "https://packages.microsoft.com/debian/12/prod": {
            "bookworm": "debian-bookworm-microsoft"
        }
    },
    "git_repositories": [
        "https://gitlab.mycompany.local"
    ],
    "pip_repository": "https://nexus.mycompany.local/repository/pypi-group",
    "npm_repository": "https://nexus.mycompany.local/repository/npm-group"
}
```

A default fallback environment called `direct` using no proxy or git/npm/apt repository is always available (it does not require a configuration file).


## Contributing

Pull requests are welcome.

See [contributing guidelines](https://gitlab.com/ipamo/swenv/-/blob/main/CONTRIBUTING.md).


## Legal

This project is licensed under the terms of the [MIT license](https://gitlab.com/ipamo/swenv/-/blob/main/LICENSE.txt).

Logo designed by [Freepik - Flaticon](https://www.flaticon.com/free-icon/global-network_4207232) (free with required attribution).
