Skip to content

Commit

Permalink
update service key value
Browse files Browse the repository at this point in the history
  • Loading branch information
pranshi06 committed Sep 9, 2024
1 parent a87b7dc commit e728d9c
Show file tree
Hide file tree
Showing 5 changed files with 1,837 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/configuration/src/to_runtime_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn make_runtime_configuration(
parsed_config: ParsedConfiguration,
environment: impl Environment,
) -> Result<crate::Configuration, MakeRuntimeConfigurationError> {
let connection_uri = match parsed_config.connection_uri {
let connection_uri = match parsed_config.service_key {
ConnectionUri(Secret::Plain(uri)) => Ok(uri),
ConnectionUri(Secret::FromEnvironment { variable }) => {
environment.read(&variable).map_err(|error| {
Expand Down
10 changes: 5 additions & 5 deletions crates/configuration/src/version1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use query_engine_metadata::metadata::{self, database, CompositeTypes, ScalarType

const CURRENT_VERSION: u32 = 1;
pub const CONFIGURATION_FILENAME: &str = "configuration.json";
pub const DEFAULT_CONNECTION_URI_VARIABLE: &str = "CONNECTION_URI";
pub const DEFAULT_CONNECTION_URI_VARIABLE: &str = "HASURA_BIGQUERY_SERVICE_KEY";
const CONFIGURATION_QUERY: &str = include_str!("config2.sql");
const CONFIGURATION_JSONSCHEMA_FILENAME: &str = "schema.json";

Expand Down Expand Up @@ -58,7 +58,7 @@ pub struct ParsedConfiguration {
// Which version of the configuration format are we using
pub version: u32,
// Connection string for a Postgres-compatible database
pub connection_uri: ConnectionUri,
pub service_key: ConnectionUri,
#[serde(skip_serializing_if = "PoolSettings::is_default")]
#[serde(default)]
pub pool_settings: PoolSettings,
Expand Down Expand Up @@ -166,7 +166,7 @@ impl ParsedConfiguration {
pub fn empty() -> Self {
Self {
version: CURRENT_VERSION,
connection_uri: ConnectionUri(Secret::FromEnvironment {
service_key: ConnectionUri(Secret::FromEnvironment {
variable: DEFAULT_CONNECTION_URI_VARIABLE.into(),
}),
pool_settings: PoolSettings::default(),
Expand Down Expand Up @@ -355,7 +355,7 @@ pub async fn configure(
// configuration_query: &str,
) -> anyhow::Result<ParsedConfiguration> {
// dbg!(args);
let uri = match &args.connection_uri {
let uri = match &args.service_key {
ConnectionUri(Secret::Plain(value)) => Cow::Borrowed(value),
ConnectionUri(Secret::FromEnvironment { variable }) => {
Cow::Owned(environment.read(variable)?)
Expand Down Expand Up @@ -524,7 +524,7 @@ pub async fn configure(

Ok(ParsedConfiguration {
version: 1,
connection_uri: args.connection_uri.clone(),
service_key: args.service_key.clone(),
pool_settings: args.pool_settings.clone(),
metadata: metadata::Metadata {
tables: tables_info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async fn test_configure() {
POSTGRESQL_CONNECTION_STRING.into(),
)]);

args.connection_uri =
args.service_key =
ConnectionUri(Secret::Plain((POSTGRESQL_CONNECTION_STRING.to_string())));

let actual = version1::configure(&args, environment)
Expand Down
Loading

0 comments on commit e728d9c

Please sign in to comment.