Skip to content

Commit

Permalink
plugin url should be an environment variable (#1057)
Browse files Browse the repository at this point in the history
<!-- The PR description should answer 2 important questions: -->

### What

The plugin URL should be an environment, not a string. This PR fixes
this.

### How

<!-- How is it trying to accomplish it (what are the implementation
steps)? -->

By changing the type

V3_GIT_ORIGIN_REV_ID: e3d4409f2dcbc70f59adc41bf61645977cab6e47
  • Loading branch information
paritosh-08 authored and hasura-bot committed Sep 5, 2024
1 parent 638d61a commit f039750
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 8 additions & 2 deletions v3/crates/open-dds/metadata.jsonschema
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,11 @@
},
"url": {
"description": "The URL to access the lifecycle plugin hook.",
"type": "string"
"allOf": [
{
"$ref": "#/definitions/EnvironmentValue"
}
]
},
"config": {
"description": "Configuration for the lifecycle plugin hook.",
Expand Down Expand Up @@ -4122,7 +4126,9 @@
"definition": {
"pre": "parse",
"name": "test",
"url": "http://localhost:8080",
"url": {
"value": "http://localhost:8080"
},
"config": {
"request": {
"headers": {
Expand Down
12 changes: 8 additions & 4 deletions v3/crates/open-dds/src/plugins.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::{data_connector::HttpHeaders, impl_OpenDd_default_for};
use crate::{data_connector::HttpHeaders, impl_OpenDd_default_for, EnvironmentValue};

#[derive(
Serialize, Deserialize, Clone, Debug, Eq, PartialEq, opendds_derive::OpenDd, JsonSchema,
Expand Down Expand Up @@ -30,7 +30,9 @@ impl LifecyclePluginHook {
"definition": {
"pre": "parse",
"name": "test",
"url": "http://localhost:8080",
"url": {
"value": "http://localhost:8080",
},
"config": {
"request": {
"headers": {
Expand Down Expand Up @@ -72,7 +74,7 @@ pub enum LifecyclePluginHookV1 {
Parse(LifecyclePluginHookPreParse),
}

type LifecyclePluginUrl = String;
type LifecyclePluginUrl = EnvironmentValue;

type LifecyclePluginName = String;

Expand Down Expand Up @@ -162,7 +164,9 @@ pub struct RawRequestConfig {
fn test_lifecycle_plugin_hook_parse() {
let hook = LifecyclePluginHook::V1(LifecyclePluginHookV1::Parse(LifecyclePluginHookPreParse {
name: "test".to_string(),
url: "http://localhost:8080".to_string(),
url: crate::EnvironmentValue {
value: "http://localhost:8080".to_string(),
},
config: LifecyclePluginHookConfig {
request: LifecyclePluginHookConfigRequest {
headers: Some(LifecyclePluginHookHeadersConfig {
Expand Down
2 changes: 1 addition & 1 deletion v3/crates/plugins/pre-execution-plugin/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ fn build_request(
pre_plugin_headers.extend(headers);
}
let mut request_builder = http_client
.post(config.url.clone())
.post(config.url.value.clone())
.headers(pre_plugin_headers);
let mut request_body = PreExecutePluginRequestBody {
session: None,
Expand Down

0 comments on commit f039750

Please sign in to comment.