#!/bin/bash


. lib/common

## XXXvlab: all this to escape forced stdout capture
VCS_MANAGER_NAME=$(
    charm=$(get_service_charm "$TARGET_SERVICE_NAME")
    SERVICE_DATASTORE="$DATASTORE/$TARGET_SERVICE_NAME" charm.run_direct_action "$charm" info name
    #run_service_action "$TARGET_SERVICE_NAME" info name
) || {
    err "vcs-manager $TARGET_SERVICE_NAME was not able to return a name upon query."
    exit 1
}


## this drone server url is a direct access to gitea, mainly
## to check credentials with the vcs manager.
config-add "\
services:
  $MASTER_BASE_SERVICE_NAME:
    environment:
      DRONE_${VCS_MANAGER_NAME^^}_SERVER: http://$TARGET_SERVICE_NAME:3000/
"