def set_from_env
      ENV_TO_KEY.each do |env_key, key|
        next unless (value = ENV[env_key])

        type, key = key if key.is_a? Array

        value =
          case type
          when :int then value.to_i
          when :float then value.to_f
          when :bool then !%w[0 false].include?(value.strip.downcase)
          when :list then value.split(/[ ,]/)
          when :dict then Hash[value.split(/[&,]/).map { |kv| kv.split('=') }]
          else value
          end

        send("#{key}=", value)
      end
    end
def set_from_env
      ENV_TO_KEY.each do |env_key, key|
        next unless (value = ENV[env_key])

        type, key = key if key.is_a? Array

        value =
          case type
          when :int then value.to_i
          when :float then value.to_f
          when :bool then !%w[0 false].include?(value.strip.downcase)
          when :list then value.split(/[ ,]/)
          when :dict then Hash[value.split(/[&,]/).map { |kv| kv.split('=') }]
          else value
          end

        send("#{key}=", value)
      end
    end
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
 rubocop:disable Metrics/AbcSize