I want to authorize the user based on his email without it getting super messy. Is there a better way to do this?
http {
map $http_user $user {
default $http_user;
}
server {
...
location ~ ^(/deployments/).*(xxx).* {
set $allow 0;
if($user = "[email protected]" || $user = "[email protected]" || $user = "[email protected]"){
set $allow 1;
}
if($allow = 0){
return 403 {error: you are not authorized}
}
}
location ~ ^(/deployments/).*(yyy).* {
set $allow 0;
if($user = "[email protected]" || $user = "[email protected]" || $user = "[email protected]"){
set $allow 1;
}
if($allow = 0){
return 403 {error: you are not authorized}
}
}
}
}
Is there a better way to do this?
I tried the above code but it doesn’t work