mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Prompt for user/password in deploy_stack.ps1
This commit updates the Windows deploy_stack.ps1 to set the basic-auth-user and basic-auth-password secrets if absent. Signed-off-by: John McCabe <john@johnmccabe.net>
This commit is contained in:
@ -2,6 +2,31 @@
|
|||||||
|
|
||||||
if (Get-Command docker -errorAction SilentlyContinue)
|
if (Get-Command docker -errorAction SilentlyContinue)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$user_secret = "basic-auth-user"
|
||||||
|
docker secret inspect $user_secret 2>&1 | out-null
|
||||||
|
if($?)
|
||||||
|
{
|
||||||
|
Write-Host "$user_secret secret exists"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$user = Read-Host 'Admin User?'
|
||||||
|
$user | docker secret create $user_secret -
|
||||||
|
}
|
||||||
|
|
||||||
|
$password_secret = "basic-auth-password"
|
||||||
|
docker secret inspect $password_secret 2>&1 | out-null
|
||||||
|
if($?)
|
||||||
|
{
|
||||||
|
Write-Host "$password_secret secret exists"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$pass = Read-Host 'Password?' -AsSecureString
|
||||||
|
[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass)) | docker secret create $password_secret -
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Deploying stack"
|
Write-Host "Deploying stack"
|
||||||
docker stack deploy func --compose-file ./docker-compose.yml
|
docker stack deploy func --compose-file ./docker-compose.yml
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user