Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
ed63eb68
Commit
ed63eb68
authored
Dec 23, 2022
by
PMExtra
Browse files
migrate FABIO to VAULT_FABIO_MODE and persist it
parent
b8d0d3c2
Changes
2
Show whitespace changes
Inline
Side-by-side
deploy/vault.sh
View file @
ed63eb68
...
@@ -66,6 +66,8 @@ vault_deploy() {
...
@@ -66,6 +66,8 @@ vault_deploy() {
_savedeployconf VAULT_TOKEN
"
$VAULT_TOKEN
"
_savedeployconf VAULT_TOKEN
"
$VAULT_TOKEN
"
fi
fi
_migratedeployconf FABIO VAULT_FABIO_MODE
# JSON does not allow multiline strings.
# JSON does not allow multiline strings.
# So replacing new-lines with "\n" here
# So replacing new-lines with "\n" here
_ckey
=
$(
sed
-z
's/\n/\\n/g'
<
"
$2
"
)
_ckey
=
$(
sed
-z
's/\n/\\n/g'
<
"
$2
"
)
...
@@ -86,7 +88,7 @@ vault_deploy() {
...
@@ -86,7 +88,7 @@ vault_deploy() {
URL
=
"
$VAULT_ADDR
/v1/
$VAULT_PREFIX
/
$_cdomain
"
URL
=
"
$VAULT_ADDR
/v1/
$VAULT_PREFIX
/
$_cdomain
"
if
[
-n
"
$
FABIO
"
]
;
then
if
[
-n
"
$
VAULT_FABIO_MODE
"
]
;
then
_info
"Writing certificate and key to
$URL
in Fabio mode"
_info
"Writing certificate and key to
$URL
in Fabio mode"
if
[
-n
"
$VAULT_KV_V2
"
]
;
then
if
[
-n
"
$VAULT_KV_V2
"
]
;
then
_post
"{
\"
data
\"
: {
\"
cert
\"
:
\"
$_cfullchain
\"
,
\"
key
\"
:
\"
$_ckey
\"
} }"
"
$URL
"
>
/dev/null
||
return
1
_post
"{
\"
data
\"
: {
\"
cert
\"
:
\"
$_cfullchain
\"
,
\"
key
\"
:
\"
$_ckey
\"
} }"
"
$URL
"
>
/dev/null
||
return
1
...
...
deploy/vault_cli.sh
View file @
ed63eb68
...
@@ -64,6 +64,8 @@ vault_cli_deploy() {
...
@@ -64,6 +64,8 @@ vault_cli_deploy() {
_savedeployconf VAULT_TOKEN
"
$VAULT_TOKEN
"
_savedeployconf VAULT_TOKEN
"
$VAULT_TOKEN
"
fi
fi
_migratedeployconf FABIO VAULT_FABIO_MODE
VAULT_CMD
=
$(
command
-v
vault
)
VAULT_CMD
=
$(
command
-v
vault
)
if
[
!
$?
]
;
then
if
[
!
$?
]
;
then
_err
"cannot find vault binary!"
_err
"cannot find vault binary!"
...
@@ -78,7 +80,7 @@ vault_cli_deploy() {
...
@@ -78,7 +80,7 @@ vault_cli_deploy() {
fi
fi
fi
fi
if
[
-n
"
$
FABIO
"
]
;
then
if
[
-n
"
$
VAULT_FABIO_MODE
"
]
;
then
_info
"Writing certificate and key to
$URL
in Fabio mode"
_info
"Writing certificate and key to
$URL
in Fabio mode"
$VAULT_CMD
kv put
"
${
VAULT_PREFIX
}
/
${
_cdomain
}
"
cert
=
@
"
$_cfullchain
"
key
=
@
"
$_ckey
"
||
return
1
$VAULT_CMD
kv put
"
${
VAULT_PREFIX
}
/
${
_cdomain
}
"
cert
=
@
"
$_cfullchain
"
key
=
@
"
$_ckey
"
||
return
1
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment