Skip to content

Commit 2f32f05

Browse files
authored
Merge pull request #46 from layer5io/kumarabd/feature/fixces
updated imagehub filter
2 parents 90ef7b9 + ac4e764 commit 2f32f05

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

api/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func CORSMiddleware(next http.Handler) http.Handler {
3333

3434
func hello(w http.ResponseWriter, req *http.Request) {
3535
token := req.Header.Get("Authorization")
36-
w.Write([]byte("Hello, " + token + ", welcome to dockercon 2020!"))
36+
w.Write([]byte("Hello, " + token + ", welcome to Istiocon 2021!"))
3737
}
3838

3939
func auth(w http.ResponseWriter, req *http.Request) {

rate-limit-filter/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl HttpContext for UpstreamCall {
7676
}
7777

7878
fn on_http_response_headers(&mut self, _num_headers: usize) -> Action {
79-
self.set_http_response_header("x-app-response", Some("reply from the filter"));
79+
self.set_http_response_header("x-app-serving", Some("rate-limit-filter"));
8080
proxy_wasm::hostcalls::log(LogLevel::Debug, format!("RESPONDING").as_str()).ok();
8181
Action::Continue
8282
}

rate-limit-filter/src/rate_limiter.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ pub struct RateLimiter {
1414
impl RateLimiter {
1515
fn new(key: &String, plan: &String) -> Self {
1616
let limit = match plan.as_str() {
17-
"group" => Some(100),
18-
"user" => Some(10),
17+
"Enterprise" => Some(100),
18+
"Team" => Some(50),
19+
"Personal" => Some(10),
1920
_ => None,
2021
};
2122
Self {
@@ -31,8 +32,9 @@ impl RateLimiter {
3132
let data: Option<Self> = bincode::deserialize(&data).unwrap_or(None);
3233
if let Some(mut obj) = data {
3334
let limit = match plan.as_str() {
34-
"group" => Some(100),
35-
"user" => Some(10),
35+
"Enterprise" => Some(100),
36+
"Team" => Some(50),
37+
"Personal" => Some(10),
3638
_ => None,
3739
};
3840
obj.rpm = limit;

0 commit comments

Comments
 (0)