mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
fix: add allow http toggle to object store settings
This commit is contained in:
@@ -96,6 +96,7 @@ pub async fn test_s3_bucket(
|
||||
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) {
|
||||
@@ -107,6 +108,15 @@ pub async fn test_s3_bucket(
|
||||
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())));
|
||||
let first_file = list
|
||||
.next()
|
||||
.await
|
||||
.ok_or_else(|| {
|
||||
error::Error::InternalErr("Failed to list files in blob storage".to_string())
|
||||
})?
|
||||
.map_err(|e| anyhow::anyhow!("error listing bucket: {e}"))?;
|
||||
tracing::info!("Listed files: {:?}", first_file);
|
||||
let path = object_store::path::Path::from(format!(
|
||||
"/test-s3-bucket-{uuid}",
|
||||
uuid = uuid::Uuid::new_v4()
|
||||
@@ -115,7 +125,7 @@ pub async fn test_s3_bucket(
|
||||
client
|
||||
.put(&path, Bytes::from_static(b"hello"))
|
||||
.await
|
||||
.map_err(to_anyhow)?;
|
||||
.map_err(|e| anyhow::anyhow!("error writing file to {path}: {e}"))?;
|
||||
let content = client
|
||||
.get(&path)
|
||||
.await
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* LICENSE-AGPL for a copy of the license.
|
||||
*/
|
||||
|
||||
use chrono::format;
|
||||
use magic_crypt::{MagicCrypt256, MagicCryptTrait};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{Postgres, Transaction};
|
||||
@@ -161,7 +162,7 @@ pub async fn get_reserved_variables(
|
||||
)
|
||||
} else if let Some(script_path) = path.clone() {
|
||||
let script_path = if script_path.ends_with("/") {
|
||||
"noname".to_string()
|
||||
format!("{script_path}state")
|
||||
} else {
|
||||
script_path
|
||||
};
|
||||
|
||||
@@ -204,11 +204,12 @@
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
if (job?.type !== 'CompletedJob' && errorCount < 4) {
|
||||
if (job?.type !== 'CompletedJob' && errorCount < 4 && !destroyed) {
|
||||
timeout = setTimeout(() => loadJobInProgress(), reducedPolling ? 5000 : 1000)
|
||||
}
|
||||
}
|
||||
|
||||
let destroyed = false
|
||||
async function updateJobId() {
|
||||
if (jobId !== job?.id) {
|
||||
$localModuleStates = {}
|
||||
@@ -244,6 +245,7 @@
|
||||
$: isListJob = flowJobIds != undefined && Array.isArray(flowJobIds?.flowJobs)
|
||||
|
||||
onDestroy(() => {
|
||||
destroyed = true
|
||||
timeout && clearTimeout(timeout)
|
||||
})
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
access_key: string
|
||||
secret_key: string
|
||||
endpoint: string
|
||||
allow_http?: boolean
|
||||
}
|
||||
|
||||
type AzureConfig = {
|
||||
@@ -28,13 +29,18 @@
|
||||
|
||||
export let bucket_config: S3Config | AzureConfig | undefined = undefined
|
||||
|
||||
$: bucket_config?.type == 'S3' &&
|
||||
bucket_config.allow_http == undefined &&
|
||||
(bucket_config.allow_http = true)
|
||||
let loading = false
|
||||
|
||||
async function testConnection() {
|
||||
loading = true
|
||||
try {
|
||||
if (bucket_config) {
|
||||
await SettingService.testObjectStorageConfig({ requestBody: bucket_config })
|
||||
await SettingService.testObjectStorageConfig({
|
||||
requestBody: bucket_config
|
||||
})
|
||||
sendUserToast('Connection successful', false)
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -151,6 +157,12 @@
|
||||
>
|
||||
<input type="text" bind:value={bucket_config.endpoint} />
|
||||
</label>
|
||||
<div class="block pb-2">
|
||||
<span class="text-tertiary text-2xs">Disable if using https only policy</span>
|
||||
<div>
|
||||
<Toggle bind:checked={bucket_config.allow_http} options={{ right: 'allow http' }} />
|
||||
</div>
|
||||
</div>
|
||||
{:else if bucket_config.type === 'Azure'}
|
||||
<label class="block pb-2">
|
||||
<span class="text-primary font-semibold text-sm">Account Name</span>
|
||||
|
||||
Reference in New Issue
Block a user