@@ -83,7 +83,7 @@ namespace duckdb
83
83
}
84
84
85
85
// TODO: Maybe this should be a KeyValueSecret
86
- static unique_ptr<BaseSecret> CreateGsheetSecretFromPrivateKey (ClientContext &context, CreateSecretInput &input) {
86
+ static unique_ptr<BaseSecret> CreateGsheetSecretFromKeyFile (ClientContext &context, CreateSecretInput &input) {
87
87
auto scope = input.scope ;
88
88
89
89
auto result = make_uniq<KeyValueSecret>(scope, input.type , input.provider , input.name );
@@ -95,16 +95,16 @@ namespace duckdb
95
95
std::ifstream ifs (filename);
96
96
json credentials_file = json::parse (ifs);
97
97
std::string email = credentials_file[" client_email" ].get <std::string>();
98
- std::string private_key_string = credentials_file[" private_key" ].get <std::string>();
98
+ std::string secret = credentials_file[" private_key" ].get <std::string>();
99
99
100
100
// Manage specific secret option
101
- (*result).secret_map [" client_email " ] = Value (email);
102
- (*result).secret_map [" sheets_private_key " ] = Value (private_key_string );
101
+ (*result).secret_map [" email " ] = Value (email);
102
+ (*result).secret_map [" secret " ] = Value (secret );
103
103
CopySecret (" filename" , input, *result); // Store the filename anyway
104
104
105
105
// Redact sensible keys
106
106
RedactCommonKeys (*result);
107
- result->redact_keys .insert (" sheets_private_key " );
107
+ result->redact_keys .insert (" secret " );
108
108
result->redact_keys .insert (" filename" );
109
109
110
110
return std::move (result);
@@ -134,10 +134,10 @@ namespace duckdb
134
134
ExtensionUtil::RegisterFunction (instance, oauth_function);
135
135
136
136
// Register the private key secret provider
137
- CreateSecretFunction private_key_function = {type, " private_key " , CreateGsheetSecretFromPrivateKey };
138
- private_key_function .named_parameters [" filename" ] = LogicalType::VARCHAR;
139
- RegisterCommonSecretParameters (private_key_function );
140
- ExtensionUtil::RegisterFunction (instance, private_key_function );
137
+ CreateSecretFunction key_file_function = {type, " key_file " , CreateGsheetSecretFromKeyFile };
138
+ key_file_function .named_parameters [" filename" ] = LogicalType::VARCHAR;
139
+ RegisterCommonSecretParameters (key_file_function );
140
+ ExtensionUtil::RegisterFunction (instance, key_file_function );
141
141
}
142
142
143
143
std::string InitiateOAuthFlow ()
0 commit comments