Skip to main content

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

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Swenv

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

Quick start

Prerequisites: Python (version >= 3.9.2)

To install using the published PyPI package, run:

pip install swenv
swenv configure

To install from the source repositority, 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):

{
    "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.

Legal

This project is licensed under the terms of the MIT license.

Logo designed by Freepik - Flaticon (free with required attribution).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swenv-1.0.2-py3-none-any.whl (35.4 kB view details)

Uploaded Python 3

File details

Details for the file swenv-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: swenv-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 35.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for swenv-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0c0a9d7267a0c8b49fee83eb4ca23ea5c4f3ef06b002237a51e1f87c36b50e8
MD5 ca8e74480a53af6157d2a33de55a9be5
BLAKE2b-256 d4c6be27678396aaefa71b937e1c5340222438c7258fb942c38058c305635da3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page