From 0266e1a6671113ae375c2d574d566bd147fb361e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 19 Jun 2020 02:07:41 +0300 Subject: [PATCH] Updated env to mode --- app/app.php | 2 +- app/controllers/api/database.php | 2 +- app/controllers/api/locale.php | 2 +- app/controllers/shared/web.php | 4 ++-- app/init.php | 2 +- app/workers/certificates.php | 2 +- composer.json | 4 ++-- composer.lock | 32 ++++++++++++++++---------------- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/app.php b/app/app.php index 31dc0d4af..c1c941471 100644 --- a/app/app.php +++ b/app/app.php @@ -292,7 +292,7 @@ $utopia->error(function ($error /* @var $error Exception */) use ($request, $res $_SERVER = []; // Reset before reporting to error log to avoid keys being compromised - $output = ((App::ENV_TYPE_DEVELOPMENT == $env)) ? [ + $output = ((App::MODE_TYPE_DEVELOPMENT == $env)) ? [ 'message' => $error->getMessage(), 'code' => $error->getCode(), 'file' => $error->getFile(), diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index 69d01e9dc..523451836 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -26,7 +26,7 @@ use GeoIp2\Database\Reader; include_once __DIR__ . '/../shared/api.php'; -$isDev = (App::ENV_TYPE_PRODUCTION !== $utopia->getEnv()); +$isDev = (App::MODE_TYPE_PRODUCTION !== $utopia->getMode()); $utopia->post('/v1/database/collections') ->desc('Create Collection') diff --git a/app/controllers/api/locale.php b/app/controllers/api/locale.php index 64978ac35..a58d86113 100644 --- a/app/controllers/api/locale.php +++ b/app/controllers/api/locale.php @@ -26,7 +26,7 @@ $utopia->get('/v1/locale') $countries = Locale::getText('countries'); $continents = Locale::getText('continents'); - if (App::ENV_TYPE_PRODUCTION !== $utopia->getEnv()) { + if (App::MODE_TYPE_PRODUCTION !== $utopia->getMode()) { $ip = '79.177.241.94'; } diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php index 42afb283e..513914df9 100644 --- a/app/controllers/shared/web.php +++ b/app/controllers/shared/web.php @@ -28,12 +28,12 @@ $layout ->setParam('class', 'unknown') ->setParam('icon', '/images/favicon.png') ->setParam('roles', $roles) - ->setParam('env', $utopia->getEnv()) + ->setParam('env', $utopia->getMode()) ; $utopia->init(function () use ($utopia, $response, $request, $layout) { $time = (60 * 60 * 24 * 45); // 45 days cache - $isDev = (\Utopia\App::ENV_TYPE_DEVELOPMENT == Config::getParam('env')); + $isDev = (\Utopia\App::MODE_TYPE_DEVELOPMENT == Config::getParam('env')); $response ->addHeader('Cache-Control', 'public, max-age='.$time) diff --git a/app/init.php b/app/init.php index 06f58f2ef..aee80e954 100644 --- a/app/init.php +++ b/app/init.php @@ -60,7 +60,7 @@ Config::load('platforms', __DIR__.'/../app/config/platforms.php'); Config::load('locales', __DIR__.'/../app/config/locales.php'); Config::load('collections', __DIR__.'/../app/config/collections.php'); -Config::setParam('env', $request->getServer('_APP_ENV', App::ENV_TYPE_PRODUCTION)); +Config::setParam('env', $request->getServer('_APP_ENV', App::MODE_TYPE_PRODUCTION)); Config::setParam('domain', $request->getServer('HTTP_HOST', '')); Config::setParam('domainVerification', false); Config::setParam('version', $request->getServer('_APP_VERSION', 'UNKNOWN')); diff --git a/app/workers/certificates.php b/app/workers/certificates.php index 611004639..84b8b0aea 100644 --- a/app/workers/certificates.php +++ b/app/workers/certificates.php @@ -105,7 +105,7 @@ class CertificatesV1 throw new Exception('Renew isn\'t required'); } - $staging = (Config::getParam('env') === App::ENV_TYPE_PRODUCTION) ? '' : ' --dry-run'; + $staging = (Config::getParam('env') === App::MODE_TYPE_PRODUCTION) ? '' : ' --dry-run'; $response = shell_exec("certbot certonly --webroot --noninteractive --agree-tos{$staging} --email security@appwrite.io \ -w ".APP_STORAGE_CERTIFICATES." \ diff --git a/composer.json b/composer.json index a692b56ba..04fe7ccd5 100644 --- a/composer.json +++ b/composer.json @@ -32,11 +32,11 @@ "appwrite/php-clamav": "1.0.*", - "utopia-php/framework": "0.2.*", + "utopia-php/framework": "0.3.1", "utopia-php/abuse": "0.2.*", "utopia-php/audit": "0.3.*", "utopia-php/cache": "0.2.*", - "utopia-php/cli": "0.5.*", + "utopia-php/cli": "0.6.1", "utopia-php/config": "0.2.*", "utopia-php/locale": "0.2.*", "utopia-php/registry": "0.2.*", diff --git a/composer.lock b/composer.lock index ef3e3d104..7fa0f139e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e93c84ab77f0085004222c942dcba6f4", + "content-hash": "79b5c353af354f8df106d2f933750102", "packages": [ { "name": "appwrite/php-clamav", @@ -1452,21 +1452,21 @@ }, { "name": "utopia-php/cli", - "version": "0.5.0", + "version": "0.6.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cli.git", - "reference": "c66255fed87f00c5a8f7cc0c482cdb082260cd32" + "reference": "0e88da425122f81020e90d575cbe80232f364b68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cli/zipball/c66255fed87f00c5a8f7cc0c482cdb082260cd32", - "reference": "c66255fed87f00c5a8f7cc0c482cdb082260cd32", + "url": "https://api.github.com/repos/utopia-php/cli/zipball/0e88da425122f81020e90d575cbe80232f364b68", + "reference": "0e88da425122f81020e90d575cbe80232f364b68", "shasum": "" }, "require": { "php": ">=7.1", - "utopia-php/framework": "0.2.*" + "utopia-php/framework": "0.*.*" }, "require-dev": { "phpunit/phpunit": "^7.0" @@ -1496,7 +1496,7 @@ "upf", "utopia" ], - "time": "2020-05-05T09:02:10+00:00" + "time": "2020-06-18T23:00:19+00:00" }, { "name": "utopia-php/config", @@ -1596,16 +1596,16 @@ }, { "name": "utopia-php/framework", - "version": "0.2.0", + "version": "0.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "e3d88b794badbd5ededcf62d708b31009111f860" + "reference": "b480f9dd01ad7990a12e90e5e4d11ded558dd8fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/e3d88b794badbd5ededcf62d708b31009111f860", - "reference": "e3d88b794badbd5ededcf62d708b31009111f860", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/b480f9dd01ad7990a12e90e5e4d11ded558dd8fc", + "reference": "b480f9dd01ad7990a12e90e5e4d11ded558dd8fc", "shasum": "" }, "require": { @@ -1636,7 +1636,7 @@ "php", "upf" ], - "time": "2020-03-08T15:42:21+00:00" + "time": "2020-06-18T22:58:05+00:00" }, { "name": "utopia-php/locale", @@ -2141,12 +2141,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "5892a510fe31de9c4200e6f9ae30e91dc5cd5a41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5892a510fe31de9c4200e6f9ae30e91dc5cd5a41", + "reference": "5892a510fe31de9c4200e6f9ae30e91dc5cd5a41", "shasum": "" }, "require": { @@ -2186,7 +2186,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "time": "2020-06-18T20:57:11+00:00" }, { "name": "phpdocumentor/type-resolver",