grafana configuration
diff --git a/README.md b/README.md
index e7e40a2..634abbe 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,22 @@
 
     grafana:
       server:
-        enabled: trues
+        enabled: true
+        source:
+          type: 'git'
+          address: https://github.com/torkelo/grafana.git
+          rev: v1.4.0
+        elasticsearch:
+          host: localhost
+          port: 9200
+        data:
+        - name: metrics1
+          type: graphite
+          host: metrics1.domain.com
+          ssl: true
+          port: 443
+          user: test
+          name: user
 
 ## Read more
 
diff --git a/conf/config.js b/conf/config.js
new file mode 100644
index 0000000..8bbe65b
--- /dev/null
+++ b/conf/config.js
@@ -0,0 +1,51 @@
+/** @scratch /configuration/config.js/1
+ * == Configuration
+ * config.js is where you will find the core Grafana configuration. This file contains parameter that
+ * must be set before kibana is run for the first time.
+ */
+define(['settings'],
+function (Settings) {
+  "use strict";
+
+  return new Settings({
+
+    /**
+     * elasticsearch url:
+     * For Basic authentication use: http://username:password@domain.com:9200
+     */
+    elasticsearch: "http://{{ pillar.grafana.server.elasticsearch.host }}:{{ pillar.grafana.server.elasticsearch.port }}",
+
+    /**
+     * graphite-web url:
+     * For Basic authentication use: http://username:password@domain.com
+     * Basic authentication requires special HTTP headers to be configured
+     * in nginx or apache for cross origin domain sharing to work (CORS).
+     * Check install documentation on github
+     */
+    graphiteUrl: "http://"+window.location.hostname+":8080",
+
+    /**
+     * Multiple graphite servers? Comment out graphiteUrl and replace with
+     *
+     *  datasources: {
+     *    data_center_us: { type: 'graphite',  url: 'http://<graphite_url>',  default: true },
+     *    data_center_eu: { type: 'graphite',  url: 'http://<graphite_url>' }
+     *  }
+     */
+
+    default_route: '/dashboard/file/default.json',
+
+    /**
+     * If your graphite server has another timezone than you & users browsers specify the offset here
+     * Example: "-0500" (for UTC - 5 hours)
+     */
+    timezoneOffset: null,
+
+    grafana_index: "grafana-dash",
+
+    panel_names: [
+      'text',
+      'graphite'
+    ]
+  });
+});
diff --git a/server.sls b/server.sls
index 3de12cd..6817274 100644
--- a/server.sls
+++ b/server.sls
@@ -10,25 +10,31 @@
   - mode: 755
   - makedirs: true
 
+{% if pillar.grafana.server.source.type == 'git' %}
+
 grafana_repository:
   git.latest:
-  - name: https://github.com/torkelo/grafana.git
-  - rev: master
+  - name: {{ pillar.grafana.server.source.address }}
+  - rev: {{ pillar.grafana.server.source.rev }}
   - target: /srv/grafana/site
   - require:
     - file: /srv/grafana
     - pkg: git_packages
 
-{#
-/srv/grafana/sites/{{ app.name }}/config/configuration.yml:
+grafana_install:
+  cmd.run:
+  - name: npm install
+  - cwd: /srv/grafana/site
+  - unless: test -e /srv/grafana/site/node_modules
+  - require:
+    - git: grafana_repository
+
+{% endif %}
+
+/srv/grafana/site/src/config.js:
   file:
   - managed
-  - source: salt://grafana/conf/configuration.yml
+  - source: salt://grafana/conf/config.js
   - template: jinja
-  - defaults:
-    app_name: "{{ app.name }}"
-  - require:
-    - hg: repo-{{ app.name }}
-#}
 
 {%- endif %}