Skip to content

Commit

Permalink
feat: support multiple environments in oauth connections (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkr authored Jul 2, 2024
1 parent 10c90c3 commit e5e7ddc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions integrationos-api/src/endpoints/connection_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub struct CreateRequest {
pub helper_link: Option<String>,
pub authentication: Vec<AuthenticationItem>,
pub auth_method: Option<AuthMethod>,
#[serde(default)]
pub multi_env: bool,
pub settings: Settings,
pub paths: Paths,
pub test_connection: Option<Id>,
Expand Down Expand Up @@ -307,6 +309,7 @@ impl RequestExt for CreateRequest {
test_connection: self.test_connection,
auth_secrets,
auth_method: self.auth_method.clone(),
multi_env: self.multi_env.clone(),
paths: self.paths.clone(),
settings: self.settings.clone(),
hidden: false,
Expand All @@ -329,6 +332,7 @@ impl RequestExt for CreateRequest {
record.frontend.spec.tags.clone_from(&self.tags);
record.test_connection = self.test_connection;
record.platform.clone_from(&self.platform);
record.multi_env = self.multi_env.clone();
record.record_metadata.active = self.active;
record
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub fn get_router() -> Router<Arc<AppState>> {
pub struct CreateRequest {
pub connection_platform: String,
pub platform_redirect_uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub sandbox_platform_redirect_uri: Option<String>,
pub ios_redirect_uri: String,
pub scopes: String,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -116,6 +118,7 @@ impl RequestExt for CreateRequest {
},
frontend: Frontend {
platform_redirect_uri: self.platform_redirect_uri.clone(),
sandbox_platform_redirect_uri: self.sandbox_platform_redirect_uri.clone(),
ios_redirect_uri: self.ios_redirect_uri.clone(),
scopes: self.scopes.clone(),
separator: self.separator.clone(),
Expand Down Expand Up @@ -176,6 +179,7 @@ impl RequestExt for CreateRequest {
};
record.frontend = Frontend {
platform_redirect_uri: self.platform_redirect_uri.clone(),
sandbox_platform_redirect_uri: self.sandbox_platform_redirect_uri.clone(),
ios_redirect_uri: self.ios_redirect_uri.clone(),
scopes: self.scopes.clone(),
separator: self.separator.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pub struct ConnectionDefinition {
pub name: String,
pub auth_secrets: Vec<AuthSecret>,
pub auth_method: Option<AuthMethod>,
#[serde(default)]
pub multi_env: bool,
pub frontend: Frontend,
pub paths: Paths,
pub settings: Settings,
Expand Down Expand Up @@ -101,6 +103,7 @@ impl ConnectionDefinition {
test_connection: None,
auth_secrets: vec![],
auth_method: None,
multi_env: false,
paths: Paths {
id: None,
event: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ pub struct ComputeRequest {
#[serde(rename_all = "camelCase")]
pub struct Frontend {
pub platform_redirect_uri: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub sandbox_platform_redirect_uri: Option<String>,
pub scopes: String,
pub ios_redirect_uri: String,
#[serde(skip_serializing_if = "Option::is_none", default = "default_separator")]
Expand Down

0 comments on commit e5e7ddc

Please sign in to comment.