#!/bin/sh

# Fail if these vars are not present (e.g. from direct wrapper runs)
: ${SNAP?} ${SNAP_DATA?}
# Copy only if not existing
cp -pn $SNAP/etc/prometheus/prometheus-openstack-exporter.yaml.example $SNAP_DATA/prometheus-openstack-exporter.yaml
test -r $SNAP_DATA/admin.novarc && . $SNAP_DATA/admin.novarc
exec $SNAP/bin/prometheus-openstack-exporter $SNAP_DATA/prometheus-openstack-exporter.yaml
