apiVersion: v1
data:
  init.bash: |
    until wget -q --spider http://configservice/manage/health;
    do 
      echo 'waiting for configservice'; 
      sleep 11; 
    done;
    
    echo 'test if config exists'
    getuseryml=$(curl -s -o /dev/null -w "%{http_code}" http://configservice/api/resources/application-userservice.yml)
    
    if [ $getuseryml = 404 ]
    then
      echo 'must create application-userservice.yml'
      postyml=$(curl -POST -w "%{http_code}" -F "resource=@/yuuvis/data/application-userservice.yml" http://configservice/api/resources/application-userservice.yml)
      
      if [ $getuseryml != 200 ]
      then
        echo 'post userservice yml failed'
        exit 1
      else
        echo 'userservice yml already exists'
      fi
    fi
kind: ConfigMap
metadata:
  name: inituserserviceconfigmap
