-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added create, update and delete for auth for subdomains #41
base: develop
Are you sure you want to change the base?
Conversation
* uses the naming convention of '*.sitename.tld' when `app_sub_type` is subdom * Passes the $site_type variable to `generate_site_auth_files` for it to use it when deleteing and updating the file. Signed-off-by: Hrishikesh Barman <[email protected]>
$global = $this->populate_info( $args, __FUNCTION__ ); | ||
$ips = \EE\Utils\get_flag_value( $assoc_args, 'ip' ); | ||
$site_url = $global ? 'default' : $this->site_data->site_url; | ||
$site_type = $global ? 'wp' : $this->site_data->app_sub_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to consider other site types. html
and PHP
site types have blank $this->site_data->app_sub_type
.
So, only check for app_sub_type
when 'wp' === $this->site_data->site_type
.
|
||
$auth_file_name = ''; | ||
switch ( $site_type ) { | ||
case 'wp': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the same cases can go in one. No need to create a seprate block of subdir
, just declare all blocks as in sugesstion. Or better yet, as there is a change in only one type of site, i.e., subdom
, you can also convert this to single if-else
.
case 'wp': | |
case 'wp': | |
case 'subdir': | |
case 'html': | |
case 'php': |
$auth_file_name = $site_url; | ||
break; | ||
case 'subdom': | ||
$auth_file_name = '*.' . $site_url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we still need to have the sitename.tld file in /opt/easyengine/services/nginx-proxy/htpasswd when we already have *.sitename.tld
It is necessary to have both the files.
Yes, in case of subdom site, create two files:
|
See : https://github.com/rtCamp/sys/issues/176#issuecomment-509517284
This PR attempts to add basic auth add, update and delete support when we create a site with
--mu=subdom
with ee4.*.sitename.tld
whenapp_sub_type
issubdom
$site_type
variable togenerate_site_auth_files
for it to use it when deleteing and updating the file.I am not sure if we still need to have the
sitename.tld
file in/opt/easyengine/services/nginx-proxy/htpasswd
when we already have*.sitename.tld
Additionally, should we do the same for the IP whitelisting?
cc @mrrobot47
Signed-off-by: Hrishikesh Barman [email protected]