Skip to content

Commit f08f6b1

Browse files
authored
Fix: Disable CORS (#36)
* update go and dependencies Signed-off-by: Joshua Irmer <irmer@gonicus.de> * remove deprecated linter Signed-off-by: Joshua Irmer <irmer@gonicus.de> * enable or disable CORS via config Signed-off-by: Joshua Irmer <irmer@gonicus.de> --------- Signed-off-by: Joshua Irmer <irmer@gonicus.de>
1 parent 34b8e7e commit f08f6b1

File tree

8 files changed

+128
-96
lines changed

8 files changed

+128
-96
lines changed

.golangci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ linters:
2323
- errorlint
2424
- exhaustive
2525
- exhaustruct
26-
- exportloopref
2726
- fatcontext
2827
# - forbidigo # unused
2928
- forcetypeassert

.zuul.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- name: ubuntu-jammy
88
label: ubuntu-jammy
99
vars:
10-
golangci_lint_version: 1.59.1
11-
go_version: 1.22.4
10+
golangci_lint_version: 1.60.3
11+
go_version: 1.23.0
1212
golangci_lint_options: --timeout 5m
1313

1414
- job:
@@ -20,7 +20,7 @@
2020
label: ubuntu-jammy
2121
vars:
2222
go_command: test ./...
23-
go_version: 1.22.4
23+
go_version: 1.23.0
2424

2525
- job:
2626
name: scs-status-page-go-build
@@ -31,7 +31,7 @@
3131
label: ubuntu-jammy
3232
vars:
3333
go_command: build cmd/status-page-api/main.go
34-
go_version: 1.22.4
34+
go_version: 1.23.0
3535

3636
- project:
3737
name: SovereignCloudStack/status-page-api

Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.io/golang:1.22.4-alpine3.20 as builder
1+
FROM docker.io/golang:1.23.0-alpine3.20 as builder
22

33
RUN apk upgrade --no-cache
44

docs/configuration.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ Configuration can be done by environment variables or flags to the binary.
44

55
Code to the configuration can be found at `internal/app/config/config.go`.
66

7-
| Environment key | Flag | Description | Type | Default |
8-
| -------------------------------------- | ---------------------------- | -------------------------------------------- | ------------ | -------------------- |
9-
| **General settings** | | | | |
10-
| STATUS_PAGE_PROVISIONING_FILE | --provisioning-file | YAML file containing the initial values | Path | ./provisioning.yaml |
11-
| STATUS_PAGE_SHUTDOWN_TIMEOUT | --shutdown-timeout | Timeout to gracefully stop the server | Duration | 10s |
12-
| STATUS_PAGE_VERBOSE | -v / --verbose | Increase log level | Counter | 0 |
13-
| **Server settings** | | | | |
14-
| STATUS_PAGE_SERVER_ADDRESS | --server-address | API server listen address | String | :3000 |
15-
| STATUS_PAGE_SERVER_ALLOWED_ORIGINS | --server-allowed-origins | List of allowed CORS origins | String Array | 127.0.0.1, localhost |
16-
| STATUS_PAGE_SERVER_SWAGGER_UI_ENABLED | --server-swagger-ui-enabled | Enable the swagger UI at `/swagger` | Boolean | False |
17-
| **Database settings** | | | | |
18-
| STATUS_PAGE_DATABASE_CONNECTION_STRING | --database-connection-string | PostgreSQL connection string | String | |
19-
| **Metrics settings** | | | | |
20-
| STATUS_PAGE_METRICS_ADDRESS | --metrics-address | Enable and set metrics server listen address | String | |
21-
| STATUS_PAGE_METRICS_NAMESPACE | --metrics-namespace | Metrics namespace | String | status_page |
22-
| STATUS_PAGE_METRICS_SUBSYSTEM | --metrics-subsystem | Metrics subsystem name | String | api |
7+
| Environment key | Flag | Description | Type | Default |
8+
| --------------------------------------- | ----------------------------- | -------------------------------------------- | ------------ | -------------------------------------- |
9+
| **General settings** | | | | |
10+
| STATUS_PAGE_PROVISIONING_FILE | --provisioning-file | YAML file containing the initial values | Path | `./provisioning.yaml` |
11+
| STATUS_PAGE_SHUTDOWN_TIMEOUT | --shutdown-timeout | Timeout to gracefully stop the server | Duration | `10s` |
12+
| STATUS_PAGE_VERBOSE | -v / --verbose | Increase log level | Counter | `0` |
13+
| **Server settings** | | | | |
14+
| STATUS_PAGE_SERVER_ADDRESS | --server-address | API server listen address | String | `:3000` |
15+
| **↳ Swagger settings** | | | | |
16+
| STATUS_PAGE_SERVER_SWAGGER_UI_ENABLED | --server-swagger-ui-enabled | Enable the swagger UI at `/swagger` | Boolean | `false` |
17+
| **↳ CORS settings** | | | | |
18+
| STATUS_PAGE_SERVER_CORS_ENABLED | --server-cors-enabled | Server handles CORS. | Boolean | `true` |
19+
| STATUS_PAGE_SERVER_CORS_ALLOWED_ORIGINS | --server-cors-allowed-origins | List of allowed CORS origins | String Array | `http://127.0.0.1`, `http://localhost` |
20+
| **Database settings** | | | | |
21+
| STATUS_PAGE_DATABASE_CONNECTION_STRING | --database-connection-string | PostgreSQL connection string | String | |
22+
| **Metrics settings** | | | | |
23+
| STATUS_PAGE_METRICS_ADDRESS | --metrics-address | Enable and set metrics server listen address | String | |
24+
| STATUS_PAGE_METRICS_NAMESPACE | --metrics-namespace | Metrics namespace | String | `status_page` |
25+
| STATUS_PAGE_METRICS_SUBSYSTEM | --metrics-subsystem | Metrics subsystem name | String | `api` |

go.mod

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module github.com/SovereignCloudStack/status-page-api
22

3-
go 1.22.4
3+
go 1.23.0
44

55
require (
66
github.com/DATA-DOG/go-sqlmock v1.5.2
7-
github.com/SovereignCloudStack/status-page-openapi v0.0.0-20240802101443-53b0b225f129
7+
github.com/SovereignCloudStack/status-page-openapi v0.0.0-20240828143820-fc80948d3426
88
github.com/google/uuid v1.6.0
99
github.com/labstack/echo-contrib v0.17.1
1010
github.com/labstack/echo/v4 v4.12.0
11-
github.com/onsi/ginkgo/v2 v2.19.0
12-
github.com/onsi/gomega v1.34.1
11+
github.com/onsi/ginkgo/v2 v2.20.1
12+
github.com/onsi/gomega v1.34.2
1313
github.com/rs/zerolog v1.33.0
1414
github.com/spf13/pflag v1.0.5
1515
github.com/spf13/viper v1.19.0
@@ -24,13 +24,13 @@ require (
2424
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2525
github.com/fsnotify/fsnotify v1.7.0 // indirect
2626
github.com/getkin/kin-openapi v0.127.0 // indirect
27-
github.com/go-logr/logr v1.4.1 // indirect
27+
github.com/go-logr/logr v1.4.2 // indirect
2828
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2929
github.com/go-openapi/swag v0.23.0 // indirect
3030
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3131
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
3232
github.com/google/go-cmp v0.6.0 // indirect
33-
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
33+
github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 // indirect
3434
github.com/hashicorp/hcl v1.0.0 // indirect
3535
github.com/invopop/yaml v0.3.1 // indirect
3636
github.com/jackc/pgpassfile v1.0.0 // indirect
@@ -40,6 +40,7 @@ require (
4040
github.com/jinzhu/inflection v1.0.0 // indirect
4141
github.com/jinzhu/now v1.1.5 // indirect
4242
github.com/josharian/intern v1.0.0 // indirect
43+
github.com/klauspost/compress v1.17.9 // indirect
4344
github.com/labstack/gommon v0.4.2 // indirect
4445
github.com/magiconair/properties v1.8.7 // indirect
4546
github.com/mailru/easyjson v0.7.7 // indirect
@@ -49,30 +50,30 @@ require (
4950
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
5051
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
5152
github.com/oapi-codegen/runtime v1.1.1 // indirect
52-
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
53+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
5354
github.com/perimeterx/marshmallow v1.1.5 // indirect
54-
github.com/prometheus/client_golang v1.19.1 // indirect
55+
github.com/prometheus/client_golang v1.20.2 // indirect
5556
github.com/prometheus/client_model v0.6.1 // indirect
56-
github.com/prometheus/common v0.55.0 // indirect
57+
github.com/prometheus/common v0.57.0 // indirect
5758
github.com/prometheus/procfs v0.15.1 // indirect
5859
github.com/sagikazarmark/locafero v0.6.0 // indirect
5960
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
6061
github.com/sourcegraph/conc v0.3.0 // indirect
6162
github.com/spf13/afero v1.11.0 // indirect
62-
github.com/spf13/cast v1.6.0 // indirect
63+
github.com/spf13/cast v1.7.0 // indirect
6364
github.com/subosito/gotenv v1.6.0 // indirect
6465
github.com/ugorji/go/codec v1.2.12 // indirect
6566
github.com/valyala/bytebufferpool v1.0.0 // indirect
6667
github.com/valyala/fasttemplate v1.2.2 // indirect
6768
go.uber.org/multierr v1.11.0 // indirect
68-
golang.org/x/crypto v0.25.0 // indirect
69-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
70-
golang.org/x/net v0.27.0 // indirect
71-
golang.org/x/sync v0.7.0 // indirect
72-
golang.org/x/sys v0.22.0 // indirect
73-
golang.org/x/text v0.16.0 // indirect
74-
golang.org/x/time v0.5.0 // indirect
75-
golang.org/x/tools v0.23.0 // indirect
69+
golang.org/x/crypto v0.26.0 // indirect
70+
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
71+
golang.org/x/net v0.28.0 // indirect
72+
golang.org/x/sync v0.8.0 // indirect
73+
golang.org/x/sys v0.24.0 // indirect
74+
golang.org/x/text v0.17.0 // indirect
75+
golang.org/x/time v0.6.0 // indirect
76+
golang.org/x/tools v0.24.0 // indirect
7677
google.golang.org/protobuf v1.34.2 // indirect
7778
gopkg.in/ini.v1 v1.67.0 // indirect
7879
)

0 commit comments

Comments
 (0)