<?php
/*
 * TARGET: config/config_custom.php.php
 * ----------------------------------------------------------------------
 * CUSTOM SETTINGS
 * 
 * Settings here override defaults from config_defaults.php
 * 
 */
return [

    'lang' => '<%= @replace["lang"] %>', // for available languages see ./config/lang/*.json

    'auth' => [
        // force using a given user ... for development only
        'forceuser' => false,

        // use a real login
        'ldap' => [
            'server'       => '<%= @replace["ldap-url"] %>',
            'port'         => <%= @replace["ldap-port"] %>,
            'DnLdapUser' => '<%= @replace["ldap-user"] %>',
            'PwLdapUser' => '<%= @replace["ldap-password"] %>',
            'DnUserNode'   => '<%= @replace["ldap-dn-user"] %>',
            'DnAppNode'    => '<%= @replace["ldap-cn-apps"] %><%= @replace["ldap-dn-apps"] %>',
            'debugLevel'   => 0,
        ]
    ],
    'banner' => '<%= @replace["banner"] %>',

    // ----------------------------------------------------------------------    

    'phases' => [
        "preview" => [],
        "stage" => [],
        "live" => [
            // prevent immediate installation after build or accept
            "deploytimes" => ['<%= @replace["deploytimes-live"] %>'],
        ],
    ],
    'showdebug' => [
        'ip'=> [<%= @replace["debug-ips"] %>],
    ],

    'projectgroups' => [<%= @replace["projectgroups"] %>],

    // ----------------------------------------------------------------------
    // build settings
    // ----------------------------------------------------------------------
    'versionsToKeep' => <%= @replace["versions-to-keep"] %>, // for cleanup: keep n unused versions
    'builtsToKeep' => <%= @replace["builds-to-keep"] %>,
    'build' => [
        'env' => 'export RVMSCRIPT="/usr/local/rvm/scripts/rvm";',
        'hooks' => [
            'build-postclone' => 'hooks/onbuild-postclone',
            'build-precompress' => 'hooks/onbuild',
        ],
    ],

    // ----------------------------------------------------------------------
    // sync of archives
    // ----------------------------------------------------------------------
    'mirrorPackages' => [<%= @replace["mirror-packages"] %>],

    // ----------------------------------------------------------------------    
    // plugins
    // existing subkeys = enabled plugins
    // ----------------------------------------------------------------------    
    'plugins'=>[

        'rollout'=>[
            'default'=>[],
            'ssh'=>[
                'user'=>'<%= @replace["rollout-ssh-user"] %>',
                'privatekey'=>'',
                'addkeycommand'=>'/usr/bin/ssh-keygen -R %s; /usr/bin/ssh-keyscan -t rsa %s >> /home/www-data/.ssh/known_hosts',
                'testcommand'=>'<%= @replace["rollout-ssh-testcommand"] %>',
                'command'=>'<%= @replace["rollout-ssh-command"] %>',
            ],
            'awx'=>[
                'url'=>'<%= @replace["rollout-axw-url"] %>', // no ending "/"
                'user'=>'<%= @replace["rollout-axw-user"] %>',
                'password'=>'<%= @replace["rollout-axw-password"] %>',
                'jobtemplate'=>'<%= @replace["rollout-axw-jobtemplate"] %>',
                'tags'=>'<%= @replace["rollout-axw-tags"] %>',
                // 'ignore-ssl-error'=>false,
            ],
        ],
    ],
    
    // ----------------------------------------------------------------------    
    // notifications to messengers ...
    // ----------------------------------------------------------------------    

    // notifications to messengers ...
    'messenger'=>[
        'slack'=>[
            'presets'=>[<%= @replace["messenger-slack-presets"] %>],
        ],
        'email'=>[
            'from'=><%= @replace["messenger-email-from"] %>,
        ],
    ],

    /*
    'foreman' => [
        'api'=>'<%= @replace["foreman-url"] %>', // with ending "/"
        'user'=>'<%= @replace["foreman-user"] %>',
        'password'=>'<%= @replace["foreman-password"] %>',
        'ignore-ssl-error'=><%= @replace["foreman-ignore-ssl-error"] %>,
        // 'varname-replace'=>'ci-replacement',
    ],
    */

    // ----------------------------------------------------------------------    
    // APPMONITOR
    // see <https://os-docs.iml.unibe.ch/appmonitor/>
    // ----------------------------------------------------------------------    

    "appmonitor" => [

        // notification

        // email notification for this application
        "email" => [<%= @replace["appmonitor-email-to"] %>],

        "slack" => [<%= @replace["appmonitor-slack"] %>],

        // limit access to appmonitor client to specific IP addresses
        "ip" => [<%= @replace["appmonitor-ip"] %>],

        // limit access to appmonitor client to specific token
        "token" => [<%= @replace["appmonitor-token"] %>],
    

    // ----------------------------------------------------------------------    

];