Productize formula

- fix role (tinyproxy.server)
- fix metadata
- various fixes
diff --git a/README.rst b/README.rst
index ce76675..598e985 100644
--- a/README.rst
+++ b/README.rst
@@ -10,14 +10,19 @@
 .. code-block:: yaml
 
     tinyproxy:
-      enabled: true
-      listen: 172.16.21.101
-      allow_nets:
-      - 127.0.0.1
-      - 172.16.21.0/24
-      connect_ports:
-      - 443
-      upstream: 10.11.236.1:8080
+      server:
+        enabled: true
+        bind:
+          address: 172.16.21.101
+          port: 8888
+        allow:
+          - 127.0.0.1
+          - 172.16.21.0/24
+        deny:
+          - 8.8.8.8
+        connect_ports:
+          - 443
+        upstream: 10.11.236.1:8080
 
 
 More Information
diff --git a/metadata.yml b/metadata.yml
index a8f9fac..32a5609 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,3 +1,3 @@
 name: "tinyproxy"
 version: "0.1"
-source: "https://github.com/mitroko/salt-formula-tinyproxy"
+source: "https://github.com/salt-formulas/salt-formula-tinyproxy"
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
new file mode 100644
index 0000000..84217d5
--- /dev/null
+++ b/metadata/service/server/single.yml
@@ -0,0 +1,6 @@
+applications:
+  - tinyproxy
+parameters:
+  tinyproxy:
+    server:
+      enabled: true
diff --git a/metadata/service/service.yml b/metadata/service/service.yml
deleted file mode 100644
index 5b1bded..0000000
--- a/metadata/service/service.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-applications:
-- tinyproxy
-parameters:
-  tinyproxy:
-    enabled: true
diff --git a/tinyproxy/files/tinyproxy.conf b/tinyproxy/files/tinyproxy.conf
index 61dd064..45d41a3 100644
--- a/tinyproxy/files/tinyproxy.conf
+++ b/tinyproxy/files/tinyproxy.conf
@@ -1,30 +1,38 @@
-{%- if pillar.tinyproxy is defined -%}
 {%- from "tinyproxy/map.jinja" import service with context -%}
-{%- endif -%}
-User {{ service.get('user', 'nobody') }}
-Group {{ service.get('group', 'nogroup') }}
-Port {{ service.get('port', '8888') }}
+User {{ service.user }}
+Group {{ service.group }}
+Listen {{ service.bind.address }}
+Port {{ service.bind.port }}
 Timeout {{ service.get('timeout', '900') }}
-Logfile "/var/log/tinyproxy/tinyproxy.log"
-LogLevel {{ service.get('log_level', 'Info') }}
+LogLevel {{ service.log.level|capitalize }}
+{%- if service.log.get('syslog') %}
+Syslog on
+{%- else %}
+Logfile "{{ service.log.file }}"
+{%- endif %}
 PidFile "/var/run/tinyproxy/tinyproxy.pid"
 XTinyproxy Yes
-Listen {{ service.get('listen', '127.0.0.1') }}
 {%- if service.upstream is defined %}
-Upstream {{ service.get('upstream', '127.0.0.1:3128') }}
+Upstream {{ service.upstream }}
 {%- endif %}
 MaxClients {{ service.get('max_clients', '550') }}
 MinSpareServers {{ service.get('minspareservers', '15') }}
 MaxSpareServers {{ service.get('maxspareservers', '20') }}
 StartServers {{ service.get('startservers', '15') }}
 MaxRequestsPerChild {{ service.get('maxrequestsperchild', '0') }}
-{%- for net in service.get('allow_nets', ['127.0.0.1']) %}
+{%- for net in service.get('allow', []) %}
 Allow {{ net }}
 {%- endfor %}
+{%- for net in service.get('deny', []) %}
+Deny {{ net }}
+{%- endfor %}
 DisableViaHeader Yes
-Anonymous "Host"
-Anonymous "Authorization"
-Anonymous "Cookie"
+{%- for anonymous in service.get('anonymous', ['Host', 'Authorization', 'Cookie']) %}
+Anonymous "{{ anonymous }}"
+{%- endfor %}
 {%- for port in service.get('connect_ports', []) %}
 ConnectPort {{ port }}
 {%- endfor %}
+{#-
+vim: syntax=jinja
+-#}
diff --git a/tinyproxy/init.sls b/tinyproxy/init.sls
index 11e507d..c59fa38 100644
--- a/tinyproxy/init.sls
+++ b/tinyproxy/init.sls
@@ -1,4 +1,6 @@
 {%- if pillar.tinyproxy is defined %}
 include:
-- tinyproxy.service
+{%- if pillar.tinyproxy.server is defined %}
+  - tinyproxy.server
+{%- endif %}
 {%- endif %}
diff --git a/tinyproxy/map.jinja b/tinyproxy/map.jinja
index 1813feb..c1c4da4 100644
--- a/tinyproxy/map.jinja
+++ b/tinyproxy/map.jinja
@@ -1,8 +1,18 @@
-{% set service = salt['grains.filter_by'](
+{% set server = salt['grains.filter_by'](
   {
-    'Debian': {
+    'default': {
       'pkgs': ["tinyproxy"],
       'service': 'tinyproxy',
+      'user': 'nobody',
+      'group': 'nogroup',
+      'log': {
+        'level': 'info',
+        'file': '/var/log/tinyproxy/tinyproxy.log',
+      },
+      'bind': {
+        'address': 0.0.0.0,
+        'port': 8888,
+      },
     },
   },
   merge = salt['pillar.get']('tinyproxy')
diff --git a/tinyproxy/service.sls b/tinyproxy/server.sls
similarity index 60%
rename from tinyproxy/service.sls
rename to tinyproxy/server.sls
index 6c6c7a6..840d00e 100644
--- a/tinyproxy/service.sls
+++ b/tinyproxy/server.sls
@@ -1,8 +1,10 @@
-{%- from "tinyproxy/map.jinja" import service with context %}
+{%- from "tinyproxy/map.jinja" import server with context %}
+
+{%- if server.get('enabled', true) %}
 
 tinyproxy_packages:
-  pkg.installed: 
-  - names: {{ service.pkgs }}
+  pkg.installed:
+  - names: {{ server.pkgs }}
 
 tinyproxy_config:
   file.managed:
@@ -15,7 +17,9 @@
 
 tinyproxy_service:
   service.running:
-  - name: {{ service.service }}
+  - name: {{ server.service }}
   - enable: true
   - watch:
     - file: tinyproxy_config
+
+{%- endif %}