PHP Classes

File: tools/installer_step_1.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   CMS Airship   tools/installer_step_1.php   Download  
File: tools/installer_step_1.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: CMS Airship
Content management system with security features
Author: By
Last change:
Date: 7 years ago
Size: 961 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);

use \
ParagonIE\ConstantTime\Base64UrlSafe;

/**
 * Used in automated deployment scripts. Generates, stores, then echos a random
 * PostgreSQL password, then sets up the web-based installer for step 2.
 */
require_once \dirname(__DIR__) . '/vendor/autoload.php';

$password = Base64UrlSafe::encode(\random_bytes(33));

\
file_put_contents(
    \
dirname(__DIR__) . '/src/tmp/installing.json',
    \
json_encode(
        [
           
'step' => 2,
           
'database' => [
                [
                    [
                       
'driver' => 'pgsql',
                       
'host' => $argv[1] ?? 'localhost',
                       
'port' => $argv[2] ?? 5432,
                       
'database' => 'airship',
                       
'username' => 'airship',
                       
'password' => $password
                   
]
                ]
            ]
        ],
       
JSON_PRETTY_PRINT
   
)
);

echo
$password;