Skip to content

Commit 91e73c5

Browse files
committed
Data in DataSource should be Vec<u8>, remove useless disable_file parameter for ClientConfigLoadOptions
1 parent 614c72e commit 91e73c5

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

core-c-bridge/include/temporal-sdk-core-c-bridge.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ typedef struct TemporalCoreClientConfigOrFail {
258258
typedef struct TemporalCoreClientConfigLoadOptions {
259259
const char *path;
260260
struct TemporalCoreByteArrayRef data;
261-
bool disable_file;
262261
bool config_file_strict;
263262
struct TemporalCoreByteArrayRef env_vars;
264263
} TemporalCoreClientConfigLoadOptions;

core-c-bridge/src/envconfig.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ pub struct ClientConfigProfileOrFail {
3030
pub fail: *const ByteArray,
3131
}
3232

33-
3433
/// Options for loading client configuration.
3534
#[repr(C)]
3635
pub struct ClientConfigLoadOptions {
3736
pub path: *const libc::c_char,
3837
pub data: ByteArrayRef,
39-
pub disable_file: bool,
4038
pub config_file_strict: bool,
4139
pub env_vars: ByteArrayRef,
4240
}
@@ -144,7 +142,7 @@ struct DataSource {
144142
#[serde(skip_serializing_if = "Option::is_none")]
145143
path: Option<String>,
146144
#[serde(skip_serializing_if = "Option::is_none")]
147-
data: Option<String>,
145+
data: Option<Vec<u8>>,
148146
}
149147

150148
impl From<CoreDataSource> for DataSource {
@@ -156,7 +154,7 @@ impl From<CoreDataSource> for DataSource {
156154
},
157155
CoreDataSource::Data(d) => Self {
158156
path: None,
159-
data: Some(String::from_utf8_lossy(&d).to_string()),
157+
data: Some(d),
160158
},
161159
}
162160
}
@@ -206,7 +204,6 @@ fn serialize_or_error<T: Serialize>(data: T) -> Result<*const ByteArray, *const
206204
}
207205
}
208206

209-
210207
/// Load all client profiles from given sources.
211208
/// Returns ClientConfigOrFail with either success JSON or error message.
212209
/// The returned ByteArrays must be freed by the caller.
@@ -224,11 +221,10 @@ pub extern "C" fn temporal_core_client_config_load(
224221

225222
let result = || -> Result<ClientConfig, String> {
226223
let opts = unsafe { &*options };
227-
let config_source = parse_config_source(opts.path, opts.data)?;
228224
let env_vars_map = parse_env_vars(opts.env_vars)?;
229225

230226
let load_options = LoadClientConfigOptions {
231-
config_source: if opts.disable_file { None } else { config_source },
227+
config_source: parse_config_source(opts.path, opts.data)?,
232228
config_file_strict: opts.config_file_strict,
233229
};
234230

@@ -276,7 +272,7 @@ pub extern "C" fn temporal_core_client_config_profile_load(
276272

277273
let result = || -> Result<ClientConfigProfile, String> {
278274
let opts = unsafe { &*options };
279-
275+
280276
let profile_name = if !opts.profile.is_null() {
281277
match unsafe { CStr::from_ptr(opts.profile) }.to_str() {
282278
Ok(s) => Some(s.to_string()),

0 commit comments

Comments
 (0)