Sha256: 9bd36ff6b7959440c3a828204e86e90b4c49bbe9c89d65545772788edb5257b4

Contents?: true

Size: 582 Bytes

Versions: 3

Compression:

Stored size: 582 Bytes

Contents

# frozen_string_literal: true

StatsLite.configure do |s, h|
  s.password "1234"
  s.port 3000

  s.data -> (data) do
    data[:ruby_current_time] = Time.now
    data[:linux_time] = h.command("date")

    data[:slow_command] = h.fetch :slow_command, -> {
      sleep 1
      "SLOW1233"
    }, expires_in: 5
  end

  s.app do |sinatra|
    sinatra.get("/another_route") do
      content_type :json

      { cpus: h.command("nproc") }.to_json
    end
  end

  s.rack do
    map "/rack" do
      run lambda { |env| [200, { "Content-Type" => "text/plain" }, ["OK"]] }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stats_lite-0.7.2 integration_test/config.rb
stats_lite-0.7.1 integration_test/config.rb
stats_lite-0.7.0 integration_test/config.rb