暂无描述

Andrew Kane 0b93762c33 Added charts 9 年之前
app 0b93762c33 Added charts 9 年之前
config febad48ae1 First commit 9 年之前
lib 1fb940aa5c Added user name method 9 年之前
.gitignore febad48ae1 First commit 9 年之前
Gemfile febad48ae1 First commit 9 年之前
LICENSE.txt febad48ae1 First commit 9 年之前
README.md 1fb940aa5c Added user name method 9 年之前
Rakefile febad48ae1 First commit 9 年之前
blazer.gemspec 0b93762c33 Added charts 9 年之前

README.md

Blazer

Create and share SQL queries instantly

View the demo

Works with PostgreSQL and MySQL

:tangerine: Battle-tested at Instacart

Features

  • Secure - works with your authentication system
  • Variables - get the same insights for multiple values
  • Linked Columns - link to other pages in your apps or around the web
  • Smart Columns - get the data your want without all the joins
  • Smart Variables - no need to remember IDs
  • Charts & Maps - a picture is worth a thousand words

Installation

Add this line to your application’s Gemfile:

gem 'blazer'

Run:

rails g blazer:install
rake db:migrate

And mount the dashboard in your config/routes.rb:

mount Blazer::Engine, at: "blazer"

For production, specify your database:

ENV["BLAZER_DATABASE_URL"]

It is highly, highly recommended to use a read only user. Keep reading to see how to create one.

Permissions

PostgreSQL

Create a user with read only permissions:

BEGIN;
CREATE ROLE blazer LOGIN PASSWORD 'secret123';
GRANT CONNECT ON DATABASE database_name TO blazer;
GRANT USAGE ON SCHEMA public TO blazer;
COMMIT;

It is highly, highly recommended to protect sensitive information with views. Documentation coming soon.

MySQL

Create a user with read only permissions:

GRANT SELECT, SHOW VIEW ON database_name.* TO blazer@’127.0.0.1′ IDENTIFIED BY ‘secret123‘;
FLUSH PRIVILEGES;

It is highly, highly recommended to protect sensitive information with views. Documentation coming soon.

Authentication

Don’t forget to protect the dashboard in production.

Basic Authentication

Set the following variables in your environment or an initializer.

ENV["BLAZER_USERNAME"] = "andrew"
ENV["BLAZER_PASSWORD"] = "secret"

Devise

authenticate :user, lambda{|user| user.admin? } do
  mount Blazer::Engine, at: "blazer"
end

Customization

Change time zone

Blazer.time_zone = "Pacific Time (US & Canada)"

Turn off audits

Blazer.audit = false

Customize user name

Blazer.user_name = :first_name

TODO

  • better readme
  • better navigation
  • standalone version
  • update lock
  • warn when database user has write permissions
  • advanced permissions
  • favorites
  • support for multiple data sources

Thanks

Blazer uses a number of awesome, open source projects.

Created by ankane and righi

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help: