Skip to content

Commit 9eadf39

Browse files
authored
adds APP_KEY to app.yaml and removes use of .env (GoogleCloudPlatform#384)
1 parent b4ee226 commit 9eadf39

File tree

5 files changed

+62
-67
lines changed

5 files changed

+62
-67
lines changed

appengine/flexible/laravel/app-dbsessions.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ env: flex
44
runtime_config:
55
document_root: public
66

7-
# required on some platforms so ".env" is not skipped
8-
skip_files: false
7+
# Ensure we skip ".env", which is only for local development
8+
skip_files:
9+
- .env
910

1011
env_variables:
11-
# The values here will override those in ".env". This is useful for
12-
# production-specific configuration. However, Feel free to set these values
13-
# in ".env" instead if you prefer.
12+
# Put production environment variables here.
1413
APP_LOG: errorlog
14+
APP_KEY: YOUR_APP_KEY
1515
STORAGE_DIR: /tmp
1616
CACHE_DRIVER: database
1717
SESSION_DRIVER: database
@@ -20,7 +20,7 @@ env_variables:
2020
DB_DATABASE: YOUR_DB_DATABASE
2121
DB_USERNAME: YOUR_DB_USERNAME
2222
DB_PASSWORD: YOUR_DB_PASSWORD
23-
DB_SOCKET: /cloudsql/YOUR_CLOUDSQL_CONNECTION_NAME
23+
DB_SOCKET: "/cloudsql/YOUR_CLOUDSQL_CONNECTION_NAME"
2424

2525
beta_settings:
2626
# for Cloud SQL, uncomment and set this value to the Cloud SQL

appengine/flexible/laravel/app.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ env: flex
44
runtime_config:
55
document_root: public
66

7-
# required on some platforms so ".env" is not skipped
8-
skip_files: false
7+
# Ensure we skip ".env", which is only for local development
8+
skip_files:
9+
- .env
910

1011
env_variables:
11-
# The values here will override those in ".env". This is useful for
12-
# production-specific configuration. However, Feel free to set these values
13-
# in ".env" instead if you prefer.
12+
# Put production environment variables here.
1413
APP_LOG: errorlog
14+
APP_KEY: YOUR_APP_KEY
1515
STORAGE_DIR: /tmp

appengine/flexible/laravel/composer.lock

Lines changed: 42 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

appengine/flexible/laravel/test/DeployDatabaseSessionTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,19 @@ private static function createLaravelProject($targetDir)
7373

7474
// copy and set the proper env vars in app.yaml
7575
$appYaml = str_replace([
76+
'YOUR_APP_KEY',
7677
'YOUR_CLOUDSQL_CONNECTION_NAME',
7778
'YOUR_DB_DATABASE',
7879
'YOUR_DB_USERNAME',
7980
'YOUR_DB_PASSWORD',
8081
], [
82+
self::execute('php artisan key:generate --show --no-ansi'),
8183
getenv('LARAVEL_CLOUDSQL_CONNECTION_NAME'),
8284
getenv('LARAVEL_DB_DATABASE'),
8385
getenv('LARAVEL_DB_USERNAME'),
8486
getenv('LARAVEL_DB_PASSWORD'),
8587
], file_get_contents(__DIR__ . '/../app-dbsessions.yaml'));
8688
file_put_contents($targetDir . '/app.yaml', $appYaml);
87-
88-
// copy over the base .env file
89-
self::execute('cp .env.example .env');
90-
91-
// generate the secret
92-
self::execute('php artisan key:generate');
9389
}
9490

9591
private static function addPostDeployCommands($targetDir)

appengine/flexible/laravel/test/DeployTest.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,13 @@ private static function createLaravelProject($targetDir)
5353
$process->setTimeout(300); // 5 minutes
5454
self::executeProcess($process);
5555

56-
// copy in the app.yaml
57-
copy(__DIR__ . '/../app.yaml', $targetDir . '/app.yaml');
58-
59-
// copy over the base .env file
60-
self::execute('cp .env.example .env');
61-
62-
// generate the secret
63-
self::execute('php artisan key:generate');
56+
// copy in the app.yaml and add the app key.
57+
$appYaml = str_replace([
58+
'YOUR_APP_KEY',
59+
], [
60+
self::execute('php artisan key:generate --show --no-ansi'),
61+
], file_get_contents(__DIR__ . '/../app.yaml'));
62+
file_put_contents($targetDir . '/app.yaml', $appYaml);
6463
}
6564

6665
private static function addPostDeployCommands($targetDir)

0 commit comments

Comments
 (0)