Skip to content

Commit ea1ae59

Browse files
committed
add default files when creating a new application
1 parent 28e50a5 commit ea1ae59

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/commands/app_new.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
'key' => $app->keys[0]->key
2222
));
2323

24+
// Generate security file
25+
$dest = Project::root(Project::DIRECTORY_NAME) . '/';
26+
$dest_file = $dest . 'security.yaml';
27+
@mkdir($dest, 0777, true);
28+
29+
$template = file_get_contents(__DIR__ . '/../../templates/security.yaml');
30+
$template = preg_replace('/{pepper}/', sha1(uniqid(true)), $template);
31+
file_put_contents($dest_file, $template);
32+
2433
if (!$args['json']) {
2534
echo "Application: {$app->name}" . PHP_EOL;
2635
echo "Keys:" . PHP_EOL;

templates/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Application key-value configs
2+
email:
3+
from: no-reply@domain.com

templates/security.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Setup a pepper to generate the encrypted password.
2-
auth_pepper: {{pepper}}
2+
# auth_pepper: {pepper}
33

44
# Whitelist of allowed host origins
55
allowed_origins:
66
- *
77

8+
# collection permissions
89
collections:
910
auths:
1011
allow: *

0 commit comments

Comments
 (0)