Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions temporalio/ext/src/envconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,14 @@ fn load_client_config_inner(
ruby: &Ruby,
config_source: Option<DataSource>,
config_file_strict: bool,
disable_file: bool,
env_vars: Option<HashMap<String, String>>,
) -> Result<RHash, Error> {
let core_config = if disable_file {
CoreClientConfig::default()
} else {
let options = LoadClientConfigOptions {
config_source,
config_file_strict,
};
core_load_client_config(options, env_vars.as_ref())
.map_err(|e| error!("EnvConfig error: {}", e))?
let options = LoadClientConfigOptions {
config_source,
config_file_strict,
};
let core_config = core_load_client_config(options, env_vars.as_ref())
.map_err(|e| error!("EnvConfig error: {}", e))?;

core_config_to_hash(ruby, &core_config)
}
Expand Down Expand Up @@ -157,18 +152,18 @@ fn load_client_connect_config_inner(
profile_to_hash(ruby, &profile)
}

// load_client_config(path: String|nil, data: String|nil, disable_file: bool, config_file_strict: bool, env_vars: Hash|nil)
// load_client_config(path: String|nil, data: String|nil, config_file_strict: bool, env_vars: Hash|nil)
fn load_client_config(args: &[magnus::Value]) -> Result<RHash, Error> {
let ruby = Ruby::get().expect("Not in Ruby thread");
let args = scan_args::scan_args::<
(Option<String>, Option<RString>, bool, bool),
(Option<String>, Option<RString>, bool),
(Option<HashMap<String, String>>,),
(),
(),
(),
(),
>(args)?;
let (path, data, disable_file, config_file_strict) = args.required;
let (path, data, config_file_strict) = args.required;
let (env_vars,) = args.optional;

let config_source = match (path, data) {
Expand All @@ -189,7 +184,6 @@ fn load_client_config(args: &[magnus::Value]) -> Result<RHash, Error> {
&ruby,
config_source,
config_file_strict,
disable_file,
env_vars,
)
}
Expand Down
3 changes: 0 additions & 3 deletions temporalio/lib/temporalio/env_config.rb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw that the sig/ filename for this file doesn't have the underscore like this one does

Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,11 @@ def self.from_h(hash)
# (TEMPORAL_CONFIG_FILE).
#
# @param config_source [Pathname, String, nil] Configuration source
# @param disable_file [Boolean] If true, file loading is disabled
# @param config_file_strict [Boolean] If true, will error on unrecognized keys
# @param override_env_vars [Hash, nil] Environment variables to use
# @return [ClientConfig] The client configuration
def self.load(
config_source: nil,
disable_file: false,
config_file_strict: false,
override_env_vars: nil
)
Expand All @@ -269,7 +267,6 @@ def self.load(
loaded_profiles = Internal::Bridge::EnvConfig.load_client_config(
path,
data,
disable_file,
config_file_strict,
override_env_vars || {}
)
Expand Down
1 change: 0 additions & 1 deletion temporalio/sig/temporalio/envconfig.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ module Temporalio

def self.load: (
?config_source: (Pathname | String)?,
?disable_file: bool,
?config_file_strict: bool,
?override_env_vars: Hash[String, String]?
) -> ClientConfig
Expand Down
6 changes: 0 additions & 6 deletions temporalio/test/envconfig_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,6 @@ def test_load_profiles_discovery
end
end

def test_load_profiles_disable_file
# With no env vars, should be empty
client_config = Temporalio::EnvConfig::ClientConfig.load(disable_file: true, override_env_vars: {})
assert_empty client_config.profiles
end

def test_default_profile_not_found_returns_empty_profile
toml = <<~TOML
[profile.existing]
Expand Down
Loading