Use env var for windows install script and remove macos/linux command line (#143)

* Use environment variable for gh user and pat

* Remove linux and macos command line
This commit is contained in:
Young Bu Park 2019-10-11 20:14:03 -07:00 committed by GitHub
parent 9a84624949
commit e64192d337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -3,12 +3,17 @@
## Install Dapr CLI
### Windows
```
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"
```
### Linux/MacOS
Note: Until the repo is public, please use the below command.
```
/usr/bin/bash "$(curl -fsSL https://raw.githubusercontent.com/dapr/cli/master/install/install.sh)"
```
powershell -Command "$Env:GITHUB_USER='your_github_id'; $Env:GITHUB_TOKEN='your_github_pat_token'; iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1?token=AC2QIRCKXC5TWOYUZLHFMWC5VJ6FI | iex"
```
### Linux/MacOS
WIP.

View File

@ -1,8 +1,3 @@
param (
[string]$GitHubUsername = "",
[string]$GitHubToken = ""
)
$ErrorActionPreference = 'stop'
# Constants
@ -10,11 +5,12 @@ $DaprRoot="c:\dapr"
$DaprRuntimeFileName = "dapr.exe"
$DaprRuntimePath = "$DaprRoot\$DaprRuntimeFileName"
if ($GitHubUsername -eq "") {
$githubHeader = @{}
# Set Github request authentication for basic authentication.
if ($Env:GITHUB_USER) {
$basicAuth = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($Env:GITHUB_USER + ":" + $Env:GITHUB_TOKEN));
$githubHeader = @{"Authorization"="Basic $basicAuth"}
} else {
$basic = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($GitHubUsername + ":" + $GitHubToken));
$githubHeader = @{"Authorization"="Basic $basic"}
$githubHeader = @{}
}
if((Get-ExecutionPolicy) -gt 'RemoteSigned' -or (Get-ExecutionPolicy) -eq 'ByPass') {