feat: add GOPROXY + fix on saved inputs
This commit is contained in:
@@ -3002,6 +3002,27 @@
|
||||
},
|
||||
"query": "DELETE FROM usr WHERE email = $1 RETURNING username"
|
||||
},
|
||||
"7a819bbf0522315952fd94d9b320fdd58e5d71dbd7e5f79eaa83c14572159805": {
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "count",
|
||||
"ordinal": 0,
|
||||
"type_info": "Int8"
|
||||
}
|
||||
],
|
||||
"nullable": [
|
||||
null
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text",
|
||||
"Text"
|
||||
]
|
||||
}
|
||||
},
|
||||
"query": "SELECT count(path) FROM raw_app WHERE path LIKE 'f/' || $1 || '%' AND workspace_id = $2"
|
||||
},
|
||||
"7aef087f9e10dd32417477109b97c99b85d68ce1be2bafdc145aed0aa8e5d989": {
|
||||
"describe": {
|
||||
"columns": [],
|
||||
|
||||
@@ -143,6 +143,7 @@ Windmill Community Edition {GIT_VERSION}
|
||||
"DENO_PATH",
|
||||
"GO_PATH",
|
||||
"GOPRIVATE",
|
||||
"GOPROXY",
|
||||
"NETRC",
|
||||
"PIP_INDEX_URL",
|
||||
"PIP_EXTRA_INDEX_URL",
|
||||
|
||||
@@ -405,6 +405,15 @@ async fn get_folder_usage(
|
||||
.await?
|
||||
.unwrap_or(0);
|
||||
|
||||
let raw_apps = sqlx::query_scalar!(
|
||||
"SELECT count(path) FROM raw_app WHERE path LIKE 'f/' || $1 || '%' AND workspace_id = $2",
|
||||
name,
|
||||
w_id
|
||||
)
|
||||
.fetch_one(&mut tx)
|
||||
.await?
|
||||
.unwrap_or(0);
|
||||
|
||||
let resources = sqlx::query_scalar!(
|
||||
"SELECT count(path) FROM resource WHERE path LIKE 'f/' || $1 || '%' AND workspace_id = $2",
|
||||
name,
|
||||
@@ -428,7 +437,7 @@ async fn get_folder_usage(
|
||||
scripts,
|
||||
flows,
|
||||
schedules,
|
||||
apps,
|
||||
apps: apps + raw_apps,
|
||||
resources,
|
||||
variables,
|
||||
}))
|
||||
|
||||
@@ -169,7 +169,7 @@ async fn list_saved_inputs(
|
||||
let rows = sqlx::query_as::<_, InputRow>(
|
||||
"select * from input \
|
||||
where runnable_id = $1 and runnable_type = $2 and workspace_id = $3 \
|
||||
and is_public IS true OR created_by = $4 \
|
||||
and (is_public IS true OR created_by = $4) \
|
||||
order by created_at desc limit $5 offset $6",
|
||||
)
|
||||
.bind(&r.runnable_id)
|
||||
|
||||
@@ -17,8 +17,8 @@ use windmill_parser_go::parse_go_imports;
|
||||
use crate::{
|
||||
common::{capitalize, read_result, set_logs},
|
||||
create_args_and_out_file, get_reserved_variables, handle_child, write_file,
|
||||
AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, GOPRIVATE, GO_CACHE_DIR, HOME_ENV,
|
||||
NETRC, NSJAIL_PATH, PATH_ENV,
|
||||
AuthedClientBackgroundTask, DISABLE_NSJAIL, DISABLE_NUSER, GOPRIVATE, GOPROXY, GO_CACHE_DIR,
|
||||
HOME_ENV, NETRC, NSJAIL_PATH, PATH_ENV,
|
||||
};
|
||||
|
||||
const GO_REQ_SPLITTER: &str = "//go.sum\n";
|
||||
@@ -207,16 +207,23 @@ func Run(req Req) (interface{{}}, error){{
|
||||
if let Some(ref netrc) = *NETRC {
|
||||
write_file(&HOME_ENV, ".netrc", netrc).await?;
|
||||
}
|
||||
Command::new(GO_PATH.as_str())
|
||||
.current_dir(job_dir)
|
||||
let mut cmd = Command::new(GO_PATH.as_str());
|
||||
cmd.current_dir(job_dir)
|
||||
.env_clear()
|
||||
.envs(reserved_variables)
|
||||
.env("PATH", PATH_ENV.as_str())
|
||||
.env("BASE_INTERNAL_URL", base_internal_url)
|
||||
.env("GOPATH", GO_CACHE_DIR)
|
||||
.env("GOPRIVATE", GOPRIVATE.as_ref().unwrap_or(&String::new()))
|
||||
.env("HOME", HOME_ENV.as_str())
|
||||
.args(vec!["run", "main.go"])
|
||||
.env("HOME", HOME_ENV.as_str());
|
||||
|
||||
if let Some(ref goprivate) = *GOPRIVATE {
|
||||
cmd.env("GOPRIVATE", goprivate);
|
||||
}
|
||||
if let Some(ref goproxy) = *GOPROXY {
|
||||
cmd.env("GOPROXY", goproxy);
|
||||
}
|
||||
|
||||
cmd.args(vec!["run", "main.go"])
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()?
|
||||
|
||||
@@ -178,6 +178,7 @@ lazy_static::lazy_static! {
|
||||
pub static ref PATH_ENV: String = std::env::var("PATH").unwrap_or_else(|_| String::new());
|
||||
pub static ref HOME_ENV: String = std::env::var("HOME").unwrap_or_else(|_| String::new());
|
||||
pub static ref GOPRIVATE: Option<String> = std::env::var("GOPRIVATE").ok();
|
||||
pub static ref GOPROXY: Option<String> = std::env::var("GOPROXY").ok();
|
||||
pub static ref NETRC: Option<String> = std::env::var("NETRC").ok();
|
||||
|
||||
static ref DENO_AUTH_TOKENS: String = std::env::var("DENO_AUTH_TOKENS")
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
export let scriptPath: string | null = null
|
||||
export let flowPath: string | null = null
|
||||
|
||||
let runnableId: string | undefined = scriptHash || scriptPath || flowPath || undefined
|
||||
let runnableId: string | undefined = scriptPath || flowPath || undefined
|
||||
let runnableType: RunnableType | undefined = scriptHash
|
||||
? RunnableType.SCRIPT_HASH
|
||||
: scriptPath
|
||||
@@ -146,7 +146,7 @@
|
||||
<div class="w-full flex justify-between items-center gap-4 flex-wrap">
|
||||
<span class="text-sm font-extrabold flex-shrink-0"
|
||||
>Saved Inputs <Tooltip
|
||||
>Shared tooltips are available to anyone with access to the script</Tooltip
|
||||
>Shared inputs are available to anyone with access to the script</Tooltip
|
||||
></span
|
||||
>
|
||||
<Button
|
||||
|
||||
@@ -205,15 +205,17 @@
|
||||
</div>
|
||||
</Pane>
|
||||
<Pane size={$savedInputPaneSize}>
|
||||
<SavedInputs
|
||||
flowPath={path}
|
||||
{isValid}
|
||||
{args}
|
||||
on:selected_args={(e) => {
|
||||
args = JSON.parse(JSON.stringify(e.detail))
|
||||
reloadArgs += 1
|
||||
}}
|
||||
/>
|
||||
{#if $savedInputPaneSize > 0}
|
||||
<SavedInputs
|
||||
flowPath={path}
|
||||
{isValid}
|
||||
{args}
|
||||
on:selected_args={(e) => {
|
||||
args = JSON.parse(JSON.stringify(e.detail))
|
||||
reloadArgs += 1
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</SplitPanesWrapper>
|
||||
|
||||
@@ -267,15 +267,18 @@
|
||||
</Pane>
|
||||
|
||||
<Pane size={$savedInputPaneSize}>
|
||||
<SavedInputs
|
||||
scriptHash={hash}
|
||||
{isValid}
|
||||
{args}
|
||||
on:selected_args={(e) => {
|
||||
args = JSON.parse(JSON.stringify(e.detail))
|
||||
reloadArgs += 1
|
||||
}}
|
||||
/>
|
||||
{#if $savedInputPaneSize > 0}
|
||||
<SavedInputs
|
||||
scriptPath={script?.path}
|
||||
scriptHash={topHash}
|
||||
{isValid}
|
||||
{args}
|
||||
on:selected_args={(e) => {
|
||||
args = JSON.parse(JSON.stringify(e.detail))
|
||||
reloadArgs += 1
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</SplitPanesWrapper>
|
||||
|
||||
Reference in New Issue
Block a user