forked from hyperledger-labs/minifabric
-
Notifications
You must be signed in to change notification settings - Fork 2
/
minifabwin
executable file
·38 lines (33 loc) · 1.29 KB
/
minifabwin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@echo off
setlocal
setlocal enabledelayedexpansion
SET _alladdress=
for /f "usebackq tokens=2 delims=:" %%a in (`ipconfig ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"`) do (
set _temp=%%a
rem remove leading space
set _ipaddress=!_temp:~1!
set _bad=0
if [!_ipaddress:~-2!]==[.0] set _bad=1
if [!_ipaddress:~-2!]==[.1] set _bad=1
if [!_bad!]==[0] (
if [!_alladdress!]==[] (
set _alladdress=!_ipaddress!
) else (
set _alladdress=!_alladdress!,!_ipaddress!
)
)
)
IF EXIST "%CD%/spec.yaml" (
echo Using spec file: %CD%\spec.yaml
set minifab_opt=%minifab_opt% -v %CD%/spec.yaml:/home/spec.yaml
) ELSE (
echo Using default spec file
)
REM inherit proxy environment variables from terminal shell, to support fabric setup onto cloud managed k8s behind proxy
REM for ansible x k8s ops
set minifab_opt=%minifab_opt% -e K8S_AUTH_PROXY=%K8S_AUTH_PROXY% -e K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH=%K8S_AUTH_PROXY_HEADERS_PROXY_BASIC_AUTH%
REM for fabric-tools ops
set minifab_opt=%minifab_opt% -e https_proxy=%https_proxy% -e no_proxy=%no_proxy%
docker run --rm --name minifab -v /var/run/docker.sock:/var/run/docker.sock -v %CD%/vars:/home/vars ^
-e "ADDRS=!_alladdress!" %minifab_opt% hyperledgerlabs/minifab:latest /home/main.sh %*
endlocal