Skip to content

Commit

Permalink
🐛 Resolved frozen ENV lookup string issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarlesky committed Aug 29, 2024
1 parent b6d12f9 commit 3d9cd04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/projectinator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ class Projectinator
def load(filepath:nil, env:{}, silent:false)
# Highest priority: command line argument
if filepath
@path_validator.standardize_paths( filepath )
_filepath = File.expand_path( filepath )
config = load_and_log( _filepath, 'from command line argument', silent )
return _filepath, config

# Next priority: environment variable
elsif env[PROJECT_FILEPATH_ENV_VAR]
filepath = env[PROJECT_FILEPATH_ENV_VAR]
_filepath = File.expand_path( filepath )
# ENV lookup is frozen so dup() to operate on the string
filepath = env[PROJECT_FILEPATH_ENV_VAR].dup()
@path_validator.standardize_paths( filepath )
_filepath = File.expand_path( filepath )
config = load_and_log(
_filepath,
"from environment variable `#{PROJECT_FILEPATH_ENV_VAR}`",
Expand Down

0 comments on commit 3d9cd04

Please sign in to comment.