Skip to content

Commit

Permalink
update error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
yurymuski committed Sep 11, 2024
1 parent e5ae5b8 commit b0c52b1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ Go to helm [Readme](helm/README.md#Usage)

### Publish new version of helm-chart:
```sh
# update helm/Chart.yaml
cd helm/packages
helm package ../
cd ../
helm repo index . --url https://yurymuski.github.io/geo-checker/helm/
cd ../
```

---
Expand Down
6 changes: 6 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ server {
if ngx.var.geoip2_data_country_code and ngx.var.geoip2_data_country_name then
ngx.say("{\"IP\":\"" .. ngx.var.header_x_real_ip .. "\",\"iso2Code\":\"" .. ngx.var.geoip2_data_country_code .. "\",\"name\":\"" .. ngx.var.geoip2_data_country_name .. "\"}")
else
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.say("{\"status\":\"header_error\"}")
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
}

Expand All @@ -118,7 +120,9 @@ server {
if ngx.var.geoip2_data_country_code_by_uri and ngx.var.geoip2_data_country_name_by_uri then
ngx.say("{\"IP\":\"" .. ngx.var.ip_uri .. "\",\"iso2Code\":\"" .. ngx.var.geoip2_data_country_code_by_uri .. "\",\"name\":\"" .. ngx.var.geoip2_data_country_name_by_uri .. "\"}")
else
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.say("{\"status\":\"ip_error\"}")
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
}

Expand All @@ -136,7 +140,9 @@ server {
elseif ngx.var.geoip2_data_country_code_by_uri and ngx.var.geoip2_data_country_name_by_uri then
ngx.say("{\"ip\":\"" .. ngx.var.ip_uri .. "\",\"country_iso_code\":\"" .. ngx.var.geoip2_data_country_code_by_uri .. "\",\"country_name\":\"" .. ngx.var.geoip2_data_country_name_by_uri .. "\"}")
else
ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
ngx.say("{\"status\":\"ip_error\"}")
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
}

Expand Down
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: geo-checker
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
type: application
version: 3.1.0
appVersion: "3.1.0"
version: 3.1.1
appVersion: "3.1.1"
home: https://github.com/yurymuski/geo-checker
sources:
- https://github.com/yurymuski/geo-checker/tree/main/helm
Expand Down
37 changes: 27 additions & 10 deletions helm/index.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
apiVersion: v1
entries:
geo-checker:
- apiVersion: v2
appVersion: 3.1.1
created: "2024-09-11T18:05:02.635718873+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 63bab1ba343bc0304065e4743f3ef8c3f6a878008b75b6ed630dd2ce67df3781
home: https://github.com/yurymuski/geo-checker
maintainers:
- email: [email protected]
name: yurymuski
name: geo-checker
sources:
- https://github.com/yurymuski/geo-checker/tree/main/helm
type: application
urls:
- https://yurymuski.github.io/geo-checker/helm/packages/geo-checker-3.1.1.tgz
version: 3.1.1
- apiVersion: v2
appVersion: 3.1.0
created: "2024-09-11T17:00:02.355188434+04:00"
created: "2024-09-11T18:05:02.635198836+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 99cc890173f39ece212953f645bdc999bcfd13ee64bd9c04f542737941c3aaa7
Expand All @@ -20,7 +37,7 @@ entries:
version: 3.1.0
- apiVersion: v2
appVersion: 3.0.1
created: "2024-09-11T17:00:02.353979251+04:00"
created: "2024-09-11T18:05:02.634715562+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: e853a1d0272a7c38b2764914e690d5c95b8127efc35d5ce20d7a039ab47e831f
Expand All @@ -37,7 +54,7 @@ entries:
version: 3.0.1
- apiVersion: v2
appVersion: 3.0.0
created: "2024-09-11T17:00:02.35280595+04:00"
created: "2024-09-11T18:05:02.634203995+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 9f679597dc25517ad2fa8ccf0006e3b6ae5c1c3ab5f37e1801ba013e5ebe728a
Expand All @@ -54,7 +71,7 @@ entries:
version: 3.0.0
- apiVersion: v2
appVersion: 2.1.1
created: "2024-09-11T17:00:02.351651538+04:00"
created: "2024-09-11T18:05:02.633716111+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 80d9f34bc852443cea3da9369e6a6ea4ae75edcf62c1ed25765bddc7300c2c9d
Expand All @@ -71,7 +88,7 @@ entries:
version: 2.1.1
- apiVersion: v2
appVersion: 2.1.0
created: "2024-09-11T17:00:02.350468669+04:00"
created: "2024-09-11T18:05:02.633180503+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 47a66c413afe09d7d2c186e91b1f116ef80bee2063ec7d7c9f9137c041c5a218
Expand All @@ -88,7 +105,7 @@ entries:
version: 2.1.0
- apiVersion: v2
appVersion: 2.0.1
created: "2024-09-11T17:00:02.349322197+04:00"
created: "2024-09-11T18:05:02.63260607+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: bd3202e700b5093d02a698834fbc30f4399f2d5bda3c60e3fd8d53cbde998d98
Expand All @@ -105,7 +122,7 @@ entries:
version: 2.0.1
- apiVersion: v2
appVersion: 2.0.0
created: "2024-09-11T17:00:02.348193818+04:00"
created: "2024-09-11T18:05:02.631808655+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: f88c3f23843f2881c7feade4f350687d0ad19dff1677ee87afba11c72488a7ff
Expand All @@ -122,7 +139,7 @@ entries:
version: 2.0.0
- apiVersion: v2
appVersion: v1-1-0
created: "2024-09-11T17:00:02.347041288+04:00"
created: "2024-09-11T18:05:02.631196445+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.Based
on openresty (nginx) and maxmind geo DB (build-in cron for geoipupdate).
digest: 9517f7d39bc69984d2e9ba2c263cd9ab2700f90110adab11225db23e5c71dfc2
Expand All @@ -139,7 +156,7 @@ entries:
version: 1.1.0
- apiVersion: v2
appVersion: v1-1-0
created: "2024-09-11T17:00:02.345842298+04:00"
created: "2024-09-11T18:05:02.63059322+04:00"
description: Geo-checker is the IP address resolver to the country_name and iso_code.
Based on openresty (nginx) and maxmind geo DB.
digest: cd31db4acf49a69cc9778f2dcff5b7a3a4fec3686974df15d036c6e74e1b2513
Expand All @@ -148,4 +165,4 @@ entries:
urls:
- https://yurymuski.github.io/geo-checker/helm/packages/geo-checker-0.1.0.tgz
version: 0.1.0
generated: "2024-09-11T17:00:02.344482047+04:00"
generated: "2024-09-11T18:05:02.629790667+04:00"
Binary file added helm/packages/geo-checker-3.1.1.tgz
Binary file not shown.

0 comments on commit b0c52b1

Please sign in to comment.