#698 -- Update traditional install to handle refactored code.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-08-05 15:24:30 -05:00
parent 5943ccca1b
commit 95d7947414
5 changed files with 27 additions and 19 deletions

5
.gitignore vendored
View File

@ -11,8 +11,9 @@ tmp/cache/*---*
/ubuntu-*-console.log
# Local development files.
app/env.ini
app/.env
/app/env.ini
/app/.env
/env.ini
/util/fixtures/*
/util/fixtures/**/*
!/util/fixtures/.gitkeep

View File

@ -28,7 +28,10 @@ define('APP_INCLUDE_CACHE', APP_INCLUDE_TEMP . '/cache');
// Set up application environment.
if (APP_INSIDE_DOCKER) {
$_ENV = getenv();
} else if (file_exists(APP_INCLUDE_BASE.'/env.ini')) {
} else if (file_exists(APP_INCLUDE_ROOT.'/env.ini')) {
$_ENV = array_merge($_ENV, parse_ini_file(APP_INCLUDE_ROOT.'/env.ini'));
} else if (file_exists(APP_INCLUDE_ROOT.'/app/env.ini')) {
// Legacy file location.
$_ENV = array_merge($_ENV, parse_ini_file(APP_INCLUDE_ROOT.'/app/env.ini'));
}

View File

@ -22,33 +22,37 @@ class MigrateConfig extends \App\Console\Command\CommandAbstract
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$env_path = APP_INCLUDE_BASE.'/env.ini';
$env_path = APP_INCLUDE_ROOT.'/env.ini';
$settings = [];
if (file_exists($env_path)) {
$settings = parse_ini_file($env_path);
if (!empty($settings['db_password'])) {
$output->writeln('Configuration already set up.');
return false;
}
}
if (empty($settings['application_env']) && file_exists(APP_INCLUDE_BASE . '/.env')) {
$settings['application_env'] = @file_get_contents(APP_INCLUDE_BASE . '/.env');
if (empty($settings['application_env']) && file_exists(APP_INCLUDE_ROOT . '/app/.env')) {
$settings['application_env'] = @file_get_contents(APP_INCLUDE_ROOT . '/app/.env');
}
if (file_exists(APP_INCLUDE_BASE.'/config/db.conf.php')) {
$db_conf = include(APP_INCLUDE_BASE.'/config/db.conf.php');
$settings['db_password'] = $db_conf['password'];
if ($db_conf['user'] === 'root') {
$settings['db_username'] = 'root';
if (empty($settings['db_password'])) {
$legacy_path = APP_INCLUDE_ROOT.'/app/env.ini';
if (file_exists($legacy_path)) {
$old_settings = parse_ini_file($legacy_path);
$settings = array_merge($settings, $old_settings);
}
if (file_exists(APP_INCLUDE_ROOT.'/app/config/db.conf.php')) {
$db_conf = include(APP_INCLUDE_ROOT.'/app/config/db.conf.php');
$settings['db_password'] = $db_conf['password'];
if ($db_conf['user'] === 'root') {
$settings['db_username'] = 'root';
}
}
}
$ini_data = [

View File

@ -1,10 +1,10 @@
---
- name: Write environment configuration file
template: src=env.ini.j2 dest="{{ www_base }}/app/env.ini" owner=azuracast group=www-data mode=0644 force=no
template: src=env.ini.j2 dest="{{ www_base }}/env.ini" owner=azuracast group=www-data mode=0644 force=no
- name: Set up environment file
ini_file:
dest: "{{ www_base }}/app/env.ini"
dest: "{{ www_base }}/env.ini"
section: "configuration"
option: "application_env"
value: "{{ app_env }}"

View File

@ -55,10 +55,10 @@
- name: Set up environment file
ini_file:
dest: "{{ www_base }}/app/env.ini"
dest: "{{ www_base }}/env.ini"
section: "configuration"
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- { option: 'db_username', value: 'azuracast' }
- { option: 'db_password', value: "{{ mysql_user_password }}" }
- { option: 'db_password', value: "{{ mysql_user_password }}" }