Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yii2-starter-kit/yii2-starter-kit…
Browse files Browse the repository at this point in the history
… into main

Signed-off-by: Victor Gonzalez <victor@vgr.cl>
  • Loading branch information
XzAeRo committed Aug 30, 2021
2 parents 1e75ebb + e3fff1e commit 0dccfaf
Show file tree
Hide file tree
Showing 14 changed files with 19,509 additions and 6,091 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ before_install:
install:
- cp .env.dist .env
- sed -i s/yii2-starter-kit-test/yii2-starter-kit/ .env
- docker-compose exec -T app composer install --dev --prefer-source --no-interaction
- docker-compose exec -T app ./vendor/bin/codecept build
- docker-compose exec -T console composer install --dev --prefer-source --no-interaction
- docker-compose exec -T console ./vendor/bin/codecept build
- sleep 10 # waiting for mysql to start accepting connections

before_script:
- docker-compose exec -T app php console/yii app/setup --interactive=0
- docker-compose exec -T app php console/yii app/truncate --interactive=0
- docker-compose exec -T app ./vendor/bin/codecept build
- docker-compose exec -T console php console/yii app/setup --interactive=0
- docker-compose exec -T console php console/yii app/truncate --interactive=0
- docker-compose exec -T console ./vendor/bin/codecept build

script:
- docker-compose exec -T app php -S 127.0.0.1:8080 > /dev/null 2>&1 &
- docker-compose exec -T app ./vendor/bin/codecept run --debug
- docker-compose exec -T console php -S 127.0.0.1:8080 > /dev/null 2>&1 &
- docker-compose exec -T console ./vendor/bin/codecept run --debug
1 change: 1 addition & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM yiisoftware/yii2-php:7.4-fpm
3 changes: 3 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM yiisoftware/yii2-php:7.4-fpm

WORKDIR /app
1 change: 0 additions & 1 deletion common/env.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
*/
defined('YII_DEBUG') or define('YII_DEBUG', env('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', env('YII_ENV', 'prod'));

22 changes: 6 additions & 16 deletions common/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,14 @@ function redirect($url, $statusCode = 302)
*/
function env($key, $default = null)
{

$value = getenv($key) ?? $_ENV[$key] ?? $_SERVER[$key];

if ($value === false) {
return $default;
}

switch (strtolower($value)) {
case 'true':
case '(true)':
return true;

case 'false':
case '(false)':
return false;
// getenv is disabled when using createImmutable with Dotenv class
if (isset($_ENV[$key])) {
return $_ENV[$key];
} elseif (isset($_SERVER[$key])) {
return $_SERVER[$key];
}

return $value;
return $default;
}

/**
Expand Down
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,16 @@
"cp .env.dist .env"
],
"build:app": [
"@composer install",
"@composer install --prefer-dist -o",
"echo 'waiting for mysql' && sleep 10",
"php console/yii app/setup --interactive=0"
],
"docker:build": [
"@build:env",
"@docker:start",
"docker-compose exec -T app composer run-script build:app",
"docker-compose run -T --rm webpacker npm i npm@latest -g",
"docker-compose run -T --rm webpacker npm install",
"docker-compose run -T --rm webpacker npm run build"
"docker-compose exec -T console composer run-script build:app",
"docker-compose run -T --rm node npm install",
"docker-compose run -T --rm node npm run build"
],
"docker:start": [
"docker-compose up --build -d"
Expand All @@ -117,9 +116,9 @@
"docker:tests": [
"@docker:start",
"docker-compose exec -T db mysql -uroot -proot -e \"CREATE DATABASE IF NOT EXISTS \\`yii2-starter-kit-test\\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci\"",
"docker-compose exec -T app ./vendor/bin/codecept build",
"docker-compose exec -T app php tests/bin/yii app/setup --interactive=0",
"echo 'open a new terminal and run \"docker-compose exec -T app vendor/bin/codecept run\"' && docker-compose exec -T app php -S localhost:8080"
"docker-compose exec -T console ./vendor/bin/codecept build",
"docker-compose exec -T console php tests/bin/yii app/setup --interactive=0",
"echo 'open a new terminal and run \"docker-compose exec -T console vendor/bin/codecept run\"' && docker-compose exec -T console php -S localhost:8080"
]
}
}
Loading

0 comments on commit 0dccfaf

Please sign in to comment.