vfox icon indicating copy to clipboard operation
vfox copied to clipboard

[Feature]: Support customized mirror

Open fangzhengjin opened this issue 1 year ago • 1 comments

1. Your usage scenarios?

Support custom mirror address, such as: For github, you can use: https://mirror.ghproxy.com For nodejs, you can use: https://npmmirror.com/mirrors/node/ or internal service of the enterprise

2. What is your expected outcome?

Use environment variables:

  • VFOX_GITHUB_MIRROR(https://mirror.ghproxy.com) => https://mirror.ghproxy.com/https://raw.githubusercontent.com/version-fox/version-fox-plugins/main/nodejs/nodejs.lua
  • VFOX_NODE_DIST_MIRROR(https://npmmirror.com/mirrors/node) => https://npmmirror.com/mirrors/node/index.json
  • ......

3. other questions: How to apply in the inner network CI environment?

Support offline / ci mode! Skip plugin version check. Provide Docker images, use offline / CI mode, install all plug -in by default, and then use the mirror installation environment set by environment variable settings, such as: VFOX_NODE_DIST_MIRROR.

fangzhengjin avatar Mar 08 '24 06:03 fangzhengjin

By the way, environment variables may be set separately for specific projects and saved in the .tool-versions / .vfoxrc file, which takes precedence over system environment variables, so that people do not have to modify environment variables frequently for different environments.

example: .vfoxrc

{
    "env": { // optional, .env priority is higher than system env
        "VFOX_NODE_DIST_MIRROR": "https://npmmirror.com/mirrors/node"
    },
    "profile": { // optional, profile.env priority is higher than .env
        "dev": {
            "env": {
                "VFOX_NODE_DIST_MIRROR": "https://npmmirror.com/mirrors/node"
            }
        },
        "ci": {
            "env": {
                "VFOX_NODE_DIST_MIRROR": "http://192.168.1.100:8000/repository/mirrors/node"
            }
        }
    },
    "tools": {
        "nodejs": "v18.19.0",
        "java": "21"
    }
}

fangzhengjin avatar Mar 08 '24 07:03 fangzhengjin