Hello,

I'm running the latest osTickets 1.6.1 in an Azure App Service container utilising automatic deployment from a private git repo (Azure DevOps). Everything works great but I'm hoping to avoid using hard coded setting in the ost-config.php file and pass the configuration values as environmental variables to the container from Azure. Here is the section of ost-config.php that I tried to modify. Unfortunately it did not worked. I'm wondering if somebody has a better (working solution) for this:

    ## Define array for environmental variables
    # ---------------------------------------------------
    $envvars = array (
        'ost_mysql_dbhost'      =>  getenv (OST_MYSQL_DBHOST),
        'ost_mysql_dbname'      =>  getenv (OST_MYSQL_DBNAME),
        'ost_mysql_dbuser'      =>  getenv (OST_MYSQL_DBUSER),
        'ost_mysql_dbpass'      =>  getenv (OST_MYSQL_DBPASS),
        'ost_admin_email'       =>  getenv (OST_ADMIN_EMAIL) ,
        'ost_table_prefix'      =>  getenv (OST_TABLE_PREFIX) 
    );
    
    # Encrypt/Decrypt secret key - randomly generated during installation.
    define('SECRET_SALT','%CONFIG-SIRI');
    
    #Default admin email. Used only on db connection issues and related alerts.
    define('ADMIN_EMAIL',$envvars['ost_admin_email']);
    
    # Database Options
    # ---------------------------------------------------
    # Mysql Login info
    define('DBTYPE','mysql'); 
    define('DBHOST',$envvars['ost_mysql_dbhost']); 
    define('DBNAME',$envvars['ost_mysql_dbname']);
    define('DBUSER',$envvars['ost_mysql_dbuser']);
    define('DBPASS',$envvars['ost_mysql_dbpass']);
    
    # Table prefix
    define('TABLE_PREFIX',$envvars['ost_table_prefix']);
  • KevinTheJedi replied to this.
  • Answering my own question about setting up OSticket on Azure App Service and passing the parameters via environmental variables.

    #Default admin email. Used only on db connection issues and related alerts.
    define('ADMIN_EMAIL',getenv('OST_ADMIN_EMAIL'));
    
    # Database Options
    # ---------------------------------------------------
    # Mysql Login info
    define('DBTYPE','mysql');
    define('DBHOST',getenv('OST_MYSQL_DBHOST'));
    define('DBNAME',getenv('OST_MYSQL_DBNAME'));
    define('DBUSER',getenv('OST_MYSQL_DBUSER'));
    define('DBPASS',getenv('OST_MYSQL_DBPASS'));
    
    # Table prefix
    define('TABLE_PREFIX',getenv('OST_TABLE_PREFIX'));

    f8d

    I've never tried this before but it should be rather trivial. This would be considered a mod/customization in which you are on your own (unless someone chimes in here).

    Cheers.

    It is trivial for a PHP programmer - But when a DBA like me tries to write PHP code then all bets are off.

    Beside the joke, if this could be somehow incorporated into the the default config file then deploying osTicket would be so much easier: just a simple git command and no file manipulation.

    Thanks a lot

    G.

    20 days later
    • Edited
    • Best Answerset by f8d

    Answering my own question about setting up OSticket on Azure App Service and passing the parameters via environmental variables.

    #Default admin email. Used only on db connection issues and related alerts.
    define('ADMIN_EMAIL',getenv('OST_ADMIN_EMAIL'));
    
    # Database Options
    # ---------------------------------------------------
    # Mysql Login info
    define('DBTYPE','mysql');
    define('DBHOST',getenv('OST_MYSQL_DBHOST'));
    define('DBNAME',getenv('OST_MYSQL_DBNAME'));
    define('DBUSER',getenv('OST_MYSQL_DBUSER'));
    define('DBPASS',getenv('OST_MYSQL_DBPASS'));
    
    # Table prefix
    define('TABLE_PREFIX',getenv('OST_TABLE_PREFIX'));

    Write a Reply...