- switch-network.sh: set GRADLE_OPTS with custom truststore when NETWORK=corp - kotlin-platform-sdk: add repos to settings.gradle.kts for composite builds - kotlin-platform-sdk: add Compose plugin + BOM + UI/Material3/Foundation deps - kotlin-platform-sdk: use kotlinOptions (stable) instead of compilerOptions
61 lines
2.6 KiB
Bash
Executable File
61 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# ─────────────────────────────────────────────────────────────
|
|
# Dual-network development setup
|
|
# ─────────────────────────────────────────────────────────────
|
|
#
|
|
# Controls: one env var — NETWORK=corp or NETWORK=home
|
|
#
|
|
# Usage (add to ~/.zshrc):
|
|
# export NETWORK=corp # at work
|
|
# export NETWORK=home # at home (or just unset it)
|
|
#
|
|
# Then source this file from ~/.zshrc:
|
|
# source "$HOME/code/mygh/learning_ai_common_plat/scripts/switch-network.sh"
|
|
#
|
|
# What it sets:
|
|
# NETWORK=corp → http_proxy, https_proxy, npm/pnpm registry, pip trusted-host
|
|
# NETWORK=home → all proxy vars unset, default registries
|
|
# ─────────────────────────────────────────────────────────────
|
|
|
|
_CORP_PROXY="http://cso.proxy.att.com:8080/"
|
|
_CORP_NPM_REGISTRY="https://jfrog-pkg-proxy.it.att.com/artifactory/api/npm/att-npm-proxy-group/"
|
|
|
|
_GRADLE_TRUSTSTORE="$HOME/.gradle/ssl/gradle-cacerts.jks"
|
|
|
|
if [ "${NETWORK:-home}" = "corp" ]; then
|
|
# ── Corporate proxy ──
|
|
export http_proxy="$_CORP_PROXY"
|
|
export https_proxy="$_CORP_PROXY"
|
|
export HTTP_PROXY="$_CORP_PROXY"
|
|
export HTTPS_PROXY="$_CORP_PROXY"
|
|
export NPM_CONFIG_REGISTRY="$_CORP_NPM_REGISTRY"
|
|
export NPM_CONFIG_PROXY="$_CORP_PROXY"
|
|
export NPM_CONFIG_HTTPS_PROXY="$_CORP_PROXY"
|
|
export NPM_CONFIG_STRICT_SSL="false"
|
|
export PIP_TRUSTED_HOST="pypi.org files.pythonhosted.org"
|
|
export NODE_TLS_REJECT_UNAUTHORIZED="0"
|
|
# Gradle: trust corporate proxy CA cert (TLS interception by cso.proxy.att.com)
|
|
if [ -f "$_GRADLE_TRUSTSTORE" ]; then
|
|
export GRADLE_OPTS="-Djavax.net.ssl.trustStore=$_GRADLE_TRUSTSTORE -Djavax.net.ssl.trustStorePassword=changeit"
|
|
fi
|
|
else
|
|
# ── Home / direct internet ──
|
|
unset http_proxy https_proxy HTTP_PROXY HTTPS_PROXY 2>/dev/null
|
|
unset NPM_CONFIG_REGISTRY NPM_CONFIG_PROXY NPM_CONFIG_HTTPS_PROXY 2>/dev/null
|
|
unset NPM_CONFIG_STRICT_SSL NODE_TLS_REJECT_UNAUTHORIZED 2>/dev/null
|
|
unset PIP_TRUSTED_HOST GRADLE_OPTS 2>/dev/null
|
|
fi
|
|
|
|
unset _GRADLE_TRUSTSTORE
|
|
|
|
# Quick status on new shell (only if interactive)
|
|
if [[ $- == *i* ]]; then
|
|
if [ "${NETWORK:-home}" = "corp" ]; then
|
|
echo "🏢 NETWORK=corp — proxy active"
|
|
else
|
|
echo "🏠 NETWORK=home — direct internet"
|
|
fi
|
|
fi
|
|
|
|
unset _CORP_PROXY _CORP_NPM_REGISTRY
|