convict = require('convict')
# Define a schema
conf = convict
  isMaster:
    doc: 'Flag to that tells mold if its a master node or a worker node'
    format: Boolean
    default: false
    env: 'MOLD_MASTER'
    arg: 'master'
  hostname:
    doc: 'The hostname that this mold instance is running on.'
    format: String
    default: 'localhost'
    env: 'HOST'
  kuePort:
    doc: 'The port to bind to bind the Kue admin UI to.'
    format: 'port'
    default: 3333
    env: 'MOLD_KUE_PORT'
  slackUrl:
    doc: 'Webhook url used to post build status messages'
    format: 'url'
    default: null
    env: 'MOLD_SLACK_URL'
  deployTarget:
    doc: 'If this worker is resides on a deploy target, specifiy which one'
    format: String
    default: 'null'
    env: 'MOLD_DEPLOY_TARGET'
  # Deploy scripts can use the following placeholders to provide
  # context to their scripts:
  #    [branch]
  #    [repo]
  #    [tag]
  deployScripts:
    doc: 'A map of repos to the shell commands needed to deploy them'
    format: Object
    default: {}



conf.loadFile '/var/mold/config.json'
# Perform validation
conf.validate strict: true
module.exports = conf
