1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/bash function start_consul_server { consul agent -bootstrap -server -bind=127.0.0.1 -data-dir=/dkv_mount_path/consul_data & } function start_api_server { pushd /dkv_mount_path/ ./dkv } if [ "$DATASTORE_IP" = "localhost" ]; then if [ "$DATASTORE" = "consul" ]; then start_consul_server sleep 5 fi fi start_api_server