-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
py
committed
Nov 25, 2024
1 parent
091a5f9
commit 138675f
Showing
10 changed files
with
231 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,28 +96,28 @@ async fn initialize(with_metadata: bool, context: Context<impl Environment>) -> | |
), | ||
supported_environment_variables: vec![ | ||
metadata::EnvironmentVariableDefinition { | ||
name: "CONNECTION_URI".to_string(), | ||
description: "The dynamodb connection URI".to_string(), | ||
name: "HASURA_DYNAMODB_AWS_ACCESS_KEY_ID".to_string(), | ||
description: "The AWS DynamoDB access key ID".to_string(), | ||
default_value: Some("dynamodbql://read_only_user:[email protected]:5432/v3-docs-sample-app".to_string()), | ||
required: false, | ||
required: true, | ||
}, | ||
metadata::EnvironmentVariableDefinition { | ||
name: "CLIENT_CERT".to_string(), | ||
description: "The SSL client certificate (Optional)".to_string(), | ||
name: "HASURA_DYNAMODB_AWS_SECRET_ACCESS_KEY".to_string(), | ||
description: "The AWS DynamoDB secret access key".to_string(), | ||
default_value: Some(String::new()), | ||
required: false | ||
required: true | ||
}, | ||
// metadata::EnvironmentVariableDefinition { | ||
// name: "HASURA_DYNAMODB_AWS_PROVIDER_NAME".to_string(), | ||
// description: "The AWS DynamoDB provider name".to_string(), | ||
// default_value: Some(String::new()), | ||
// required: true, | ||
// }, | ||
metadata::EnvironmentVariableDefinition { | ||
name: "CLIENT_KEY".to_string(), | ||
description: "The SSL client key (Optional)".to_string(), | ||
name: "HASURA_DYNAMODB_AWS_REGION".to_string(), | ||
description: "The AWS DynamoDB region".to_string(), | ||
default_value: Some(String::new()), | ||
required: false, | ||
}, | ||
metadata::EnvironmentVariableDefinition { | ||
name: "ROOT_CERT".to_string(), | ||
description: "The SSL root certificate (Optional)".to_string(), | ||
default_value: Some(String::new()), | ||
required: false, | ||
required: true, | ||
}, | ||
], | ||
commands: metadata::Commands { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,39 @@ | ||
//! Database connection settings. | ||
use crate::values::{Secret, ServiceKey}; | ||
use crate::values::{Secret, AccessKeyId, SecretAccessKey, ProviderName, Region}; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
pub const DEFAULT_CONNECTION_URI_PLACEHOLDER: &str = "HASURA_DYNAMODB_CONNECTION_URI_PLACEHOLDER"; | ||
pub const DEFAULT_ACCESS_KEY_ID_VARIABLE: &str = "HASURA_DYNAMODB_AWS_ACCESS_KEY_ID"; | ||
pub const DEFAULT_SECRET_ACCESS_KEY_VARIABLE: &str = "HASURA_DYNAMODB_AWS_SECRET_ACCESS_KEY"; | ||
pub const DEFAULT_PROVIDER_NAME: &str = "HASURA_DYNAMODB_AWS_PROVIDER_NAME"; | ||
pub const DEFAULT_REGION_VARIABLE: &str = "HASURA_DYNAMODB_AWS_REGION"; | ||
|
||
/// Database connection settings. | ||
#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize, JsonSchema)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct DatabaseConnectionSettings { | ||
/// Connection string for a Postgres-compatible database. | ||
pub connection_placeholder: ServiceKey, | ||
pub access_key_id: AccessKeyId, | ||
pub secret_access_key: SecretAccessKey, | ||
// pub provider_name: ProviderName, | ||
pub region: Region, | ||
} | ||
|
||
impl DatabaseConnectionSettings { | ||
pub fn empty() -> Self { | ||
Self { | ||
connection_placeholder: ServiceKey(Secret::FromEnvironment { | ||
variable: DEFAULT_CONNECTION_URI_PLACEHOLDER.into(), | ||
}) | ||
access_key_id: AccessKeyId(Secret::FromEnvironment { | ||
variable: DEFAULT_ACCESS_KEY_ID_VARIABLE.into(), | ||
}), | ||
secret_access_key: SecretAccessKey(Secret::FromEnvironment { | ||
variable: DEFAULT_SECRET_ACCESS_KEY_VARIABLE.into(), | ||
}), | ||
// provider_name: ProviderName(Secret::FromEnvironment { | ||
// variable: DEFAULT_PROVIDER_NAME.into(), | ||
// }), | ||
region: Region(Secret::FromEnvironment { | ||
variable: DEFAULT_REGION_VARIABLE.into(), | ||
}), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
mod secret; | ||
mod pool_settings; | ||
mod connection_info; | ||
pub mod connection_info; | ||
|
||
pub use secret::Secret; | ||
pub use pool_settings::PoolSettings; | ||
pub use connection_info::ServiceKey; | ||
pub use connection_info::{AccessKeyId, SecretAccessKey, ProviderName, Region}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.