mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
fix(cli): expose an encrypt value endpoint
This commit is contained in:
@@ -1181,6 +1181,29 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
|
||||
/w/{workspace}/variables/encrypt:
|
||||
post:
|
||||
summary: encrypt value
|
||||
operationId: encryptValue
|
||||
tags:
|
||||
- variable
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/WorkspaceId"
|
||||
requestBody:
|
||||
description: new variable
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: encrypted value
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
|
||||
/w/{workspace}/variables/delete/{path}:
|
||||
delete:
|
||||
summary: delete variable
|
||||
|
||||
@@ -40,6 +40,7 @@ pub fn workspaced_service() -> Router {
|
||||
.route("/update/*path", post(update_variable))
|
||||
.route("/delete/*path", delete(delete_variable))
|
||||
.route("/create", post(create_variable))
|
||||
.route("/encrypt", post(encrypt_value))
|
||||
}
|
||||
|
||||
async fn list_contextual_variables(
|
||||
@@ -257,6 +258,21 @@ async fn create_variable(
|
||||
))
|
||||
}
|
||||
|
||||
async fn encrypt_value(
|
||||
Extension(db): Extension<DB>,
|
||||
Path(w_id): Path<String>,
|
||||
Json(variable): Json<String>,
|
||||
) -> Result<String> {
|
||||
let mut tx = db.begin().await?;
|
||||
|
||||
let mc = build_crypt(&mut tx, &w_id).await?;
|
||||
let value = encrypt(&mc, &variable);
|
||||
|
||||
tx.commit().await?;
|
||||
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
async fn delete_variable(
|
||||
authed: Authed,
|
||||
Extension(user_db): Extension<UserDB>,
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ async function pull(opts: GlobalOptions) {
|
||||
x.name + ".resource-type.json",
|
||||
undefined,
|
||||
x,
|
||||
false
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user