@meistrari/mise-en-place 2.16.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile CHANGED
@@ -16,7 +16,7 @@ mise-en-place: .editorconfig ## Setup the mise en place to start cooking
16
16
  @echo "Mise en place is ready! 🍳"
17
17
 
18
18
  .PHONY: global-envs
19
- global-envs:
19
+ global-envs: ## Export global environment variables from Infisical
20
20
  @infisical export --env development --projectId $(INFISICAL_PROJECT_ID_GLOBALS)
21
21
  # endregion
22
22
 
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bash
2
+ #MISE description="Check if Infisical is logged in. Triggers login if not."
3
+ #USAGE flag "--login" negate="--no-login" default=#true help="Trigger login if not logged in. If false, exits with code 1 if not logged in."
4
+ #USAGE flag "-f --force" default=#false help="Force login even if already logged in."
5
+ #USAGE flag "-d --domain <domain>" default="https://app.infisical.com" help="Infisical domain to pass to login command." env="INFISICAL_DOMAIN"
6
+ #MISE quiet=true
7
+ #MISE interactive=true
8
+
9
+ set -euo pipefail
10
+
11
+
12
+ check_status() {
13
+ infisical login status &>/dev/null
14
+ }
15
+
16
+ login () {
17
+ infisical login --domain $usage_domain --silent
18
+ }
19
+
20
+ if [ $usage_force = true ]; then
21
+ login
22
+ fi
23
+
24
+ if [ $usage_login = false ]; then
25
+ check_status || exit 1
26
+ exit 0
27
+ fi
28
+
29
+ if ! check_status; then
30
+ login
31
+ fi
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bash
2
+ #MISE description="Import secrets from VaultSecrets"
3
+
4
+ set -euo pipefail
5
+
6
+ export VAULT_ADDR="${VAULT_ADDR:-https://secrets.tela.tools}"
7
+
8
+ APP_NAME="${1:-${APP_NAME:-}}"
9
+
10
+ if [ -z "$APP_NAME" ]; then
11
+ echo "APP_NAME is required. Pass it as the first argument or set the APP_NAME environment variable." >&2
12
+ exit 1
13
+ fi
14
+
15
+ WORKLOAD_PATH="${2:-${WORKLOAD_PATH:-}}"
16
+
17
+ if [ -z "$WORKLOAD_PATH" ]; then
18
+ echo "WORKLOAD_PATH is required. Pass it as the second argument or set the WORKLOAD_PATH environment variable." >&2
19
+ exit 1
20
+ fi
21
+
22
+ FILE_NAME="${3:-${FILE_NAME:-}}"
23
+
24
+ if [ -z "$FILE_NAME" ]; then
25
+ echo "FILE_NAME is required. Pass it as the third argument or set the FILE_NAME environment variable." >&2
26
+ exit 1
27
+ fi
28
+
29
+ ENV=development
30
+
31
+ SECRET_PATH="$APP_NAME/$ENV/$WORKLOAD_PATH"
32
+
33
+ if ! SECRET_JSON="$(vault kv get -mount=kv -format=json "$SECRET_PATH" 2>&1)"; then
34
+ echo "Failed to read kv/$SECRET_PATH from $VAULT_ADDR:" >&2
35
+ echo "$SECRET_JSON" >&2
36
+ echo "" >&2
37
+ echo "Inspect it in the browser: $VAULT_ADDR/ui/vault/secrets/kv/kv/list/${APP_NAME}/" >&2
38
+ exit 1
39
+ fi
40
+
41
+ echo "$SECRET_JSON" \
42
+ | jq -r '.data.data | to_entries[] | "\(.key)=\(.value | @sh)"' > "$FILE_NAME"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ #MISE description="Login to VaultSecrets"
3
+
4
+ export VAULT_ADDR="${VAULT_ADDR:-https://secrets.tela.tools}"
5
+
6
+ vault login -method=oidc
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meistrari/mise-en-place",
3
- "version": "2.16.0",
3
+ "version": "2.18.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",