mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-09 00:04:10 +00:00
fix(cli): guide users to migrate to node version of the CLI
This commit is contained in:
@@ -802,7 +802,9 @@ pub async fn reload_s3_cache_setting(db: &DB) {
|
||||
secret_key: None,
|
||||
endpoint: None,
|
||||
store_logs: None,
|
||||
path_style: None,
|
||||
allow_http: None,
|
||||
port: None,
|
||||
})
|
||||
.await
|
||||
.ok();
|
||||
|
||||
@@ -104,21 +104,12 @@ use windmill_common::s3_helpers::build_object_store_from_settings;
|
||||
|
||||
#[cfg(feature = "parquet")]
|
||||
pub async fn test_s3_bucket(
|
||||
Extension(db): Extension<DB>,
|
||||
authed: ApiAuthed,
|
||||
_authed: ApiAuthed,
|
||||
Json(test_s3_bucket): Json<ObjectSettings>,
|
||||
) -> error::Result<String> {
|
||||
use bytes::Bytes;
|
||||
use futures::StreamExt;
|
||||
use windmill_common::ee::{get_license_plan, LicensePlan};
|
||||
|
||||
if matches!(get_license_plan().await, LicensePlan::Pro) {
|
||||
return Err(error::Error::InternalErr(
|
||||
"This feature is only available in Enterprise, not Pro".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
require_super_admin(&db, &authed.email).await?;
|
||||
let client = build_object_store_from_settings(test_s3_bucket).await?;
|
||||
|
||||
let mut list = client.list(Some(&object_store::path::Path::from("".to_string())));
|
||||
|
||||
@@ -64,7 +64,6 @@ pub enum StorageResourceType {
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct S3Resource {
|
||||
#[serde(rename = "bucket")]
|
||||
pub bucket: String,
|
||||
pub region: String,
|
||||
#[serde(rename = "endPoint")]
|
||||
@@ -380,7 +379,9 @@ pub struct S3Settings {
|
||||
pub secret_key: Option<String>,
|
||||
pub endpoint: Option<String>,
|
||||
pub allow_http: Option<bool>, // default to true
|
||||
pub path_style: Option<bool>,
|
||||
pub store_logs: Option<bool>,
|
||||
pub port: Option<u16>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "parquet")]
|
||||
@@ -421,8 +422,8 @@ pub async fn build_s3_client_from_settings(
|
||||
access_key,
|
||||
secret_key,
|
||||
use_ssl: !settings.allow_http.unwrap_or(true),
|
||||
path_style: None,
|
||||
port: None,
|
||||
path_style: settings.path_style,
|
||||
port: settings.port,
|
||||
token: None,
|
||||
};
|
||||
|
||||
|
||||
+20
-18
@@ -187,25 +187,27 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
if (esMain.default(import.meta)) {
|
||||
function isMain() {
|
||||
// dnt-shim-ignore
|
||||
const { Deno } = globalThis as any;
|
||||
|
||||
const isDeno = Deno != undefined;
|
||||
|
||||
if (isDeno) {
|
||||
const isMain = import.meta.main;
|
||||
if (isMain) {
|
||||
log.warn(
|
||||
"Using the deno runtime for the Windmill CLI is deprecated, you can now use node: deno uninstall wmill && npm install -g windmill-cli"
|
||||
);
|
||||
}
|
||||
return isMain;
|
||||
} else {
|
||||
//@ts-ignore
|
||||
return esMain.default(import.meta);
|
||||
}
|
||||
}
|
||||
if (isMain()) {
|
||||
main();
|
||||
// test1();
|
||||
// test2();
|
||||
// module was not imported but called directly
|
||||
}
|
||||
|
||||
// function test1() {
|
||||
// // dnt-shim-ignore deno-lint-ignore no-explicit-any
|
||||
// const { Deno, process } = globalThis as any;
|
||||
|
||||
// console.log(Deno);
|
||||
// }
|
||||
|
||||
// function test2() {
|
||||
// const { Deno, process } = globalThis as any;
|
||||
|
||||
// console.log(Deno);
|
||||
// }
|
||||
|
||||
export default command;
|
||||
|
||||
@@ -47,18 +47,36 @@
|
||||
},
|
||||
s3: {
|
||||
code: `
|
||||
import { S3Client } from "https://deno.land/x/s3_lite_client@0.6.1/mod.ts";
|
||||
import * as wmill from "windmill-client"
|
||||
|
||||
type S3 = object
|
||||
|
||||
export async function main(s3: S3) {
|
||||
const s3client = new S3Client(s3);
|
||||
for await (const obj of s3client.listObjects({ prefix: "/" })) {
|
||||
console.log(obj);
|
||||
}
|
||||
return fetch(process.env["BASE_URL"] + '/api/settings/test_object_storage_config', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + process.env["WM_TOKEN"],
|
||||
},
|
||||
body: JSON.stringify({
|
||||
type: "S3",
|
||||
bucket: s3.bucket,
|
||||
endpoint: s3.endPoint,
|
||||
port: s3.port,
|
||||
allow_http: !s3.useSSL,
|
||||
access_key: s3.accessKey,
|
||||
secret_key: s3.secretKey,
|
||||
path_style: s3.pathStyle,
|
||||
}),
|
||||
}).then(async (res) => {
|
||||
if (!res.ok) {
|
||||
throw new Error(await res.text())
|
||||
}
|
||||
return res.text()
|
||||
})
|
||||
}
|
||||
`,
|
||||
lang: 'deno',
|
||||
lang: 'bun',
|
||||
argName: 's3'
|
||||
},
|
||||
graphql: {
|
||||
|
||||
Reference in New Issue
Block a user