@@ -111,11 +111,14 @@ public function __construct() {
111
111
* [--admin-user=<admin-user>]
112
112
* : Username of the administrator.
113
113
*
114
+ * [--admin-email=<admin-email>]
115
+ * : E-Mail of the administrator.
116
+ *
114
117
* [--admin-pass=<admin-pass>]
115
118
* : Password for the the administrator.
116
119
*
117
- * [--admin-email=<admin-email> ]
118
- * : E-Mail of the administrator.
120
+ * [--allow-insecure-pass ]
121
+ * : Allow insecure password for the the administrator.
119
122
*
120
123
* [--local-db]
121
124
* : Create separate db container instead of using global db.
@@ -292,23 +295,24 @@ public function create( $args, $assoc_args ) {
292
295
$ alias_domain_to_check [] = $ this ->site_data ['site_url ' ];
293
296
check_alias_in_db ( $ alias_domain_to_check );
294
297
295
- $ this ->site_data ['site_fs_path ' ] = WEBROOT . $ this ->site_data ['site_url ' ];
296
- $ this ->cache_type = \EE \Utils \get_flag_value ( $ assoc_args , 'cache ' );
297
- $ wildcard_flag = \EE \Utils \get_flag_value ( $ assoc_args , 'wildcard ' );
298
- $ this ->site_data ['site_ssl_wildcard ' ] = 'subdom ' === $ this ->site_data ['app_sub_type ' ] || $ wildcard_flag ? true : false ;
299
- $ this ->site_data ['php_version ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'php ' , 'latest ' );
300
- $ this ->site_data ['app_admin_url ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'title ' , $ this ->site_data ['site_url ' ] );
301
- $ this ->site_data ['app_admin_username ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'admin-user ' , \EE \Utils \random_name_generator () );
302
- $ this ->site_data ['app_admin_password ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'admin-pass ' , '' );
303
- $ this ->site_data ['db_name ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbname ' , str_replace ( [ '. ' , '- ' ], '_ ' , $ this ->site_data ['site_url ' ] ) );
304
- $ this ->site_data ['db_host ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbhost ' , GLOBAL_DB );
305
- $ this ->site_data ['db_port ' ] = '3306 ' ;
306
- $ this ->site_data ['db_user ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbuser ' , $ this ->create_site_db_user ( $ this ->site_data ['site_url ' ] ) );
307
- $ this ->site_data ['db_password ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbpass ' , \EE \Utils \random_password () );
308
- $ this ->site_data ['proxy_cache ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'proxy-cache ' );
309
- $ this ->locale = \EE \Utils \get_flag_value ( $ assoc_args , 'locale ' , \EE ::get_config ( 'locale ' ) );
310
- $ local_cache = \EE \Utils \get_flag_value ( $ assoc_args , 'with-local-redis ' );
311
- $ this ->site_data ['cache_host ' ] = '' ;
298
+ $ this ->site_data ['site_fs_path ' ] = WEBROOT . $ this ->site_data ['site_url ' ];
299
+ $ this ->cache_type = \EE \Utils \get_flag_value ( $ assoc_args , 'cache ' );
300
+ $ wildcard_flag = \EE \Utils \get_flag_value ( $ assoc_args , 'wildcard ' );
301
+ $ this ->site_data ['site_ssl_wildcard ' ] = 'subdom ' === $ this ->site_data ['app_sub_type ' ] || $ wildcard_flag ? true : false ;
302
+ $ this ->site_data ['php_version ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'php ' , 'latest ' );
303
+ $ this ->site_data ['app_admin_url ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'title ' , $ this ->site_data ['site_url ' ] );
304
+ $ this ->site_data ['app_admin_username ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'admin-user ' , \EE \Utils \random_name_generator () );
305
+ $ this ->site_data ['app_admin_password ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'admin-pass ' , '' );
306
+ $ this ->site_data ['allow_insecure_pass ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'allow-insecure-pass ' , false );
307
+ $ this ->site_data ['db_name ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbname ' , str_replace ( [ '. ' , '- ' ], '_ ' , $ this ->site_data ['site_url ' ] ) );
308
+ $ this ->site_data ['db_host ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbhost ' , GLOBAL_DB );
309
+ $ this ->site_data ['db_port ' ] = '3306 ' ;
310
+ $ this ->site_data ['db_user ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbuser ' , $ this ->create_site_db_user ( $ this ->site_data ['site_url ' ] ) );
311
+ $ this ->site_data ['db_password ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'dbpass ' , \EE \Utils \random_password () );
312
+ $ this ->site_data ['proxy_cache ' ] = \EE \Utils \get_flag_value ( $ assoc_args , 'proxy-cache ' );
313
+ $ this ->locale = \EE \Utils \get_flag_value ( $ assoc_args , 'locale ' , \EE ::get_config ( 'locale ' ) );
314
+ $ local_cache = \EE \Utils \get_flag_value ( $ assoc_args , 'with-local-redis ' );
315
+ $ this ->site_data ['cache_host ' ] = '' ;
312
316
if ( 'on ' === $ this ->site_data ['proxy_cache ' ] ) {
313
317
$ this ->cache_type = true ;
314
318
}
@@ -318,7 +322,7 @@ public function create( $args, $assoc_args ) {
318
322
319
323
if ( empty ( $ this ->site_data ['app_admin_password ' ] ) ) {
320
324
$ this ->site_data ['app_admin_password ' ] = \EE \Utils \random_password ( 18 );
321
- } else {
325
+ } elseif ( ! $ this -> site_data [ ' allow_insecure_pass ' ] ) {
322
326
$ pass_error_msg = [];
323
327
if ( strlen ( $ this ->site_data ['app_admin_password ' ] ) < 8 ) {
324
328
$ pass_error_msg [] = "Password too short! Must be at least 8 characters long. " ;
@@ -1206,6 +1210,12 @@ private function install_wp() {
1206
1210
throw new \Exception ( 'WordPress install failed. Please check logs. ' );
1207
1211
}
1208
1212
1213
+ $ env_type = \EE ::get_runner ()->config ['env ' ];
1214
+ $ env_type = in_array ( $ env_type , [ 'production ' , 'staging ' , 'development ' , 'local ' ] ) ? $ env_type : '' ;
1215
+ if ( ! empty ( $ env_type ) ) {
1216
+ EE ::exec ( 'docker-compose exec --user= \'www-data \' php wp config set --type=constant WP_ENVIRONMENT_TYPE \'' . $ env_type . '\' ' );
1217
+ }
1218
+
1209
1219
\EE ::success ( $ prefix . $ this ->site_data ['site_url ' ] . ' has been created successfully! ' );
1210
1220
}
1211
1221
0 commit comments