github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/foundation/consul/data/common/app-dev-dep/main.sh.tpl (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  oe() { $@ 2>&1 | logger -t otto > /dev/null; }
     5  ol() { echo "[otto] $@"; }
     6  
     7  # Write the service file
     8  ol "Configuring consul service: {{ app_config.ServiceName }}"
     9  cat <<DOC >/tmp/service.json
    10  {
    11    "service": {
    12      "name": "{{ app_config.ServiceName }}",
    13      "tags": [],
    14      "port": {{ app_config.ServicePort }}
    15    }
    16  }
    17  DOC
    18  oe chmod 0644 /tmp/service.json
    19  oe sudo mv /tmp/service.json /etc/consul.d/service.{{ app_config.ServiceName }}.json
    20  
    21  # Reload consul. It is okay if this fails.
    22  oe consul reload