パッケージレジストリプロキシを環境変数で設定するやつ

概要

世間でサプライチェーン攻撃がひどいので Takumi Guard を使わせていただく。

設定

  • 設定が散らばると面倒なのですべて環境変数で設定する方針
  • 自分が使いそうなやつだけ
  • ちょっと面倒なのでトークンは付与しない路線
1
2
3
4
5
6
export NPM_CONFIG_REGISTRY=https://npm.flatt.tech
export PNPM_CONFIG_REGISTRY=https://npm.flatt.tech
export YARN_NPM_REGISTRY_SERVER=https://npm.flatt.tech
export GOPROXY=https://golang.flatt.tech
export BUNDLE_MIRROR__RUBYGEMS__ORG=https://rubygems.flatt.tech
export PIP_INDEX_URL=https://pypi.flatt.tech/simple

確認

npm

1
2
$ npm config get registry
https://npm.flatt.tech

pnpm

上記設定は v11 以上向け。v10 以下は NPM_CONFIG_REGISTRY が参照される。

1
2
$ pnpm config get registry
https://npm.flatt.tech/

yarn

1
2
$ yarn config get npmRegistryServer
https://npm.flatt.tech

go

1
2
$ go env GOPROXY
https://golang.flatt.tech

bundler

1
2
3
$ bundle config get mirror.rubygems.org
Settings for `mirror.rubygems.org` in order of priority. The top value will be used
Set via BUNDLE_MIRROR__RUBYGEMS__ORG: "https://rubygems.flatt.tech"

pip

1
2
$ pip config get :env:.index-url
https://pypi.flatt.tech/simple