<?php

/** @var string Directory containing all of the site's files */
$root_dir = dirname(__DIR__);

/** @var string Document Root */
$webroot_dir = $root_dir;

/**
 * Expose global env() function from oscarotero/env
 */
Env::init();

/**
 * Set up our global environment constant and load its config first
 * Default: development
 */
define('WP_ENV', env('WP_ENV') ?: 'development');

$env_config = __DIR__ . '/environments/' . WP_ENV . '.php';

if (file_exists($env_config)) {
    require_once $env_config;
}

/**
 * URLs
 */
define('WP_HOME', env('WP_HOME') ?: 'http://localhost');
define('WP_SITEURL', WP_HOME . '/wp');

/**
 * Custom Content Directory
 */
define('CONTENT_DIR', '/app');
define('WP_CONTENT_DIR', $webroot_dir . CONTENT_DIR);
define('WP_CONTENT_URL', WP_HOME . CONTENT_DIR);
define('VP_PROJECT_ROOT', $webroot_dir . '/wp/');

/**
 * DB settings
 */
define('DB_NAME', env('MYSQL_DATABASE'));
define('DB_USER', env('MYSQL_USER'));
define('DB_PASSWORD', env('MYSQL_PASSWORD'));
define('DB_HOST', env('WP_DB_HOST') ?: 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');
$table_prefix = env('DB_PREFIX') ?: 'wp_';

/**
 * Authentication Unique Keys and Salts
 */
define('AUTH_KEY', env('WP_AUTH_KEY'));
define('SECURE_AUTH_KEY', env('WP_SECURE_AUTH_KEY'));
define('LOGGED_IN_KEY', env('WP_LOGGED_IN_KEY'));
define('NONCE_KEY', env('WP_NONCE_KEY'));
define('AUTH_SALT', env('WP_AUTH_SALT'));
define('SECURE_AUTH_SALT', env('WP_SECURE_AUTH_SALT'));
define('LOGGED_IN_SALT', env('WP_LOGGED_IN_SALT'));
define('NONCE_SALT', env('WP_NONCE_SALT'));

define('JWT_AUTH_SECRET_KEY', env('WP_JWT_AUTH_SECRET_KEY'));
define('JWT_AUTH_CORS_ENABLE', true);

/**
 * Wiaas Env variables
 */
define('WIAAS_CUSTOMER_INTERFACE', env('WIAAS_CUSTOMER_INTERFACE') ?: WP_HOME);

/**
 * Custom Settings
 */
define('AUTOMATIC_UPDATER_DISABLED', true);
define('DISABLE_WP_CRON', env('DISABLE_WP_CRON') ?: false);
define('DISALLOW_FILE_EDIT', true);

/**
 * Bootstrap WordPress
 */
if (!defined('ABSPATH')) {
    define('ABSPATH', $webroot_dir . '/wp/');
}