fastlane/lib/fastlane/lane_manager.rb in fastlane-2.8.0 vs fastlane/lib/fastlane/lane_manager.rb in fastlane-2.9.0
- old
+ new
@@ -160,11 +160,15 @@
UI.user_error! "Run `fastlane` the next time you need to build, test or release your app 🚀"
end
end
def self.load_dot_env(env)
- base_path = FastlaneCore::FastlaneFolder.path || '.'
- return if Dir.glob(File.join(base_path, '*.env*'), File::FNM_DOTMATCH).count == 0
+ # search for dotenvs in either fastlane or the current dir
+ search_paths = [FastlaneCore::FastlaneFolder.path, '.'].compact
+ base_path = search_paths.find do |dir|
+ Dir.glob(File.join(dir, '*.env*'), File::FNM_DOTMATCH).count > 0
+ end
+ return unless base_path
require 'dotenv'
Actions.lane_context[Actions::SharedValues::ENVIRONMENT] = env if env
# Making sure the default '.env' and '.env.default' get loaded