@@ -15,6 +15,7 @@ function wputools__wpconfig_set_values(){
1515 _WPCLICOMMAND config set WP_MAX_MEMORY_LIMIT 256M;
1616 _WPCLICOMMAND config set AUTOMATIC_UPDATER_DISABLED true ;
1717 _WPCLICOMMAND config set WP_AUTO_UPDATE_CORE false ;
18+ _WPCLICOMMAND config set WP_ENVIRONMENT_TYPE ' local' ;
1819}
1920
2021# ##################################
@@ -38,19 +39,26 @@ wpconfig_site_id=$(bashutilities_get_user_var "- What is your project ID?" "proj
3839wpconfig_site_prefix=$( bashutilities_get_user_var " - What is your site prefix?" " wp_" ) ;
3940
4041# Default values
41- mysql_host=' localhost' ;
42- mysql_user=' root' ;
43- mysql_password=' root' ;
44- mysql_database=" ${wpconfig_site_id} " ;
45- project_raw_domain=" ${wpconfig_site_id} .test" ;
42+ wputools__mysql_host=' localhost' ;
43+ wputools__mysql_user=' root' ;
44+ wputools__mysql_password=' root' ;
45+ wputools__mysql_database=" ${wpconfig_site_id} " ;
46+ wputools__project_raw_domain=" ${wpconfig_site_id} .test" ;
47+ wputools__use_https=' n' ;
48+ wputools__protocol=' http' ;
4649
4750wpconfig_default_settings=$( bashutilities_get_yn " - Use default settings? (localhost/root/root)" ' y' ) ;
4851if [[ " ${wpconfig_default_settings} " != ' y' ]]; then
49- mysql_host=$( bashutilities_get_user_var " - What is the MySQL host?" " localhost" ) ;
50- mysql_user=$( bashutilities_get_user_var " - What is the MySQL user?" " root" ) ;
51- mysql_password=$( bashutilities_get_user_var " - What is the MySQL password?" " root" ) ;
52- mysql_database=$( bashutilities_get_user_var " - What is the MySQL database?" " ${wpconfig_site_id} " ) ;
53- project_raw_domain=$( bashutilities_get_user_var " - What is the project domain name?" " ${wpconfig_site_id} .test" ) ;
52+ wputools__mysql_host=$( bashutilities_get_user_var " - What is the MySQL host?" " localhost" ) ;
53+ wputools__mysql_user=$( bashutilities_get_user_var " - What is the MySQL user?" " root" ) ;
54+ wputools__mysql_password=$( bashutilities_get_user_var " - What is the MySQL password?" " root" ) ;
55+ wputools__mysql_database=$( bashutilities_get_user_var " - What is the MySQL database?" " ${wpconfig_site_id} " ) ;
56+ wputools__project_raw_domain=$( bashutilities_get_user_var " - What is the project domain name?" " ${wpconfig_site_id} .test" ) ;
57+ wputools__use_https=$( bashutilities_get_yn " - Use HTTPS for site URL?" ' n' ) ;
58+ fi ;
59+
60+ if [[ " ${wputools__use_https} " == ' y' ]]; then
61+ wputools__protocol=' https' ;
5462fi ;
5563
5664# ##################################
5967
6068_WPCLICOMMAND core config \
6169 --skip-check \
62- --dbhost=" ${mysql_host } " \
63- --dbname=" ${mysql_database } " \
64- --dbuser=" ${mysql_user } " \
65- --dbpass=" ${mysql_password } " \
70+ --dbhost=" ${wputools__mysql_host } " \
71+ --dbname=" ${wputools__mysql_database } " \
72+ --dbuser=" ${wputools__mysql_user } " \
73+ --dbpass=" ${wputools__mysql_password } " \
6674 --dbprefix=" ${wpconfig_site_prefix} " \
6775 --extra-php << PHP
6876
6977# URLs
7078if(!isset(\$ _SERVER['HTTP_HOST']) || !\$ _SERVER['HTTP_HOST']){
71- \$ _SERVER['HTTP_HOST'] = '${project_raw_domain } ';
79+ \$ _SERVER['HTTP_HOST'] = '${wputools__project_raw_domain } ';
7280}
7381if(!isset(\$ _SERVER['SERVER_PROTOCOL']) || !\$ _SERVER['SERVER_PROTOCOL']){
7482 \$ _SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0';
7583}
76- define('WP_SITEURL', 'http://' . \$ _SERVER['HTTP_HOST'] . '/');
77- define('WP_HOME', 'http://' . \$ _SERVER['HTTP_HOST'] . '/');
78-
79- # Environment
80- define('WP_ENVIRONMENT_TYPE', 'local');
84+ define('WP_SITEURL', '${wputools__protocol} ://' . \$ _SERVER['HTTP_HOST'] . '/');
85+ define('WP_HOME', '${wputools__protocol} ://' . \$ _SERVER['HTTP_HOST'] . '/');
8186
8287# Block external access
8388#define('WP_HTTP_BLOCK_EXTERNAL', true);
0 commit comments