Skip to content

Commit 907411d

Browse files
authored
Merge pull request #1 from iamgoroot/doc-update
Doc update
2 parents 4317124 + 93c536e commit 907411d

File tree

79 files changed

+2498
-1580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2498
-1580
lines changed

.golangci.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
run:
2-
go: '1.23'
31
linters:
42
enable:
53
- bodyclose

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ update:
66
generate:
77
go list -f '{{.Dir}}/...' -m | xargs go generate
88
lint:
9-
go list -f '{{.Dir}}/...' -m | xargs go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -v --fix -c .golangci.yaml
9+
go list -f '{{.Dir}}/...' -m | xargs go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run -j 4 --allow-parallel-runner -v --fix -c .golangci.yaml
1010
structalign:
1111
go list -f '{{.Dir}}' -m | xargs -I {} sh -c 'cd {} && go run golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment -fix ./...'

README.md

Lines changed: 71 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
Backline is a minimalistic Internal Developer Portal (IDP) inspired by Backstage, built using Go and HTMX. It provides a flexible and extensible platform for exploring various developer resources.
44

55
## Table of Contents
6+
- [Demo](#demo)
67
- [Features](#features)
78
- [Why?](#why)
89
- [Getting Started](#getting-started)
9-
- [Customization](#customization)
10-
- [Configuration](#configuration)
11-
- [Basics](#basics)
12-
- [Core Config](#core-config)
13-
- [Repository Configuration](#repository-configuration)
14-
- [Key-Value Storage Configuration](#key-value-storage-configuration)
15-
- [Distributed Lock Configuration](#distributed-lock-configuration)
16-
- [Job Scheduler Configuration](#job-scheduler-configuration)
17-
- [Existing Plugins](#existing-plugins)
18-
- [Plugin Development](#plugin-development)
1910
- [Contributing](#contributing)
2011
- [License](#license)
2112

@@ -39,131 +30,102 @@ Some features may be disabled (for example "Scan" button)
3930
- **Lower learning curve**: Backline is designed to be easier to learn and use.
4031
- **Simpler upgrades**: Unlike Backstage, which requires scaffolding and is hard to upgrade, Backline isn't scaffolded and should work just by updating go.mod.
4132
- **Easy plugin development**:
42-
- Plugins register themselves and do not require any code modifications.
33+
- Plugins register themselves and do not require any code modifications (for now you need to include them into your main file as dependency. Later should be possible to just drop them as *.so files into plugins folder).
4334
- Plugins implement statically typed interfaces, making them easy to implement and detect version incompatibilities.
4435
- **Addressing Backstage issues**:
36+
- Backstage does not support search on openapi and asyncapi specs (closed as not planned [backstage/backstage#22802](https://github.com/backstage/backstage/issues/22802)).
4537
- Backstage does not respect some relations like `apiProvidedBy` out of the box [backstage/backstage#25387](https://github.com/backstage/backstage/issues/25387).
4638
- Plugins use different HTTP clients that may not respect proxy settings [help-im-behind-a-corporate-proxy](https://github.com/backstage/backstage/blob/master/contrib/docs/tutorials/help-im-behind-a-corporate-proxy.md).
4739

4840
## Getting Started
4941

50-
To get started with Backline with default plugins, run:
42+
To get started with Backline you need to add as least few plugins or specify implementations for core functionality
5143

52-
```bash
53-
go run github.com/iamgoroot/backline/cmd/backline --config {your-config-location}/config.yaml
54-
```
44+
Let's start with a simple example of running just catalog and scanner with minimalistic set of plugins
45+
We will use the following plugins/features:
5546

56-
This will run Backline with default plugins. You can also run it within your own application as a library:
47+
* Discovery for entities on file system
48+
* PostgreSQL plugin for storage (both entity and as Key-Value)
49+
* PostgreSQL plugin for distributed lock (using pg_try_advisory_xact_lock)
50+
* Default plugin for scheduler (this is only option for now)
51+
* Default theme (with dark and light modes depending on OS theme)
5752

5853
```golang
59-
application := app.App{
60-
// run catalog and scanner
61-
PluggableDeps: app.PluggableDeps{
62-
EntityDiscoveries: []core.Discovery{ // Add Location Readers so Backline knows how to read entities from different sources
63-
&fs.Discovery{}, &github.Discovery{},
64-
},
65-
EntityRepo: &store.Repo{}, // set repository plugin configurable with config file. supports pg and sqlite
66-
KeyValStore: &store.KV{}, // set key-value storage plugin configurable with config file. supports pg and sqlite
67-
JobScheduler: &store.Scheduler{}, // set job scheduler plugin configurable with config file. supports pg and sqlite
68-
DistributedLocker: &store.Locker{}, // set distributed lock plugin configurable with config file. supports pg and sqlite
69-
},
70-
Plugins: []core.Plugin{
71-
catalog.Plugin{}, // add web interface for catalog
72-
oauth2.Plugin{}, // add oauth2 plugin for catalog authentication
73-
stock.Theme{}, // add stock theme for catalog
74-
&techdocs.Plugin{}, // add techdocs documentation plugin
75-
&scanner.Plugin{}, // add scanner plugin to scan/read entities
76-
openapiexplorer.Plugin{}, // add ability to display openapi specs on entity pages
77-
rawdefinition.Plugin{}, // add ability to display raw API definitions on entity pages
78-
},
79-
}
80-
81-
err := application.Run()
54+
application := app.App{
55+
// run catalog and scanner
56+
57+
PluggableDeps: app.PluggableDeps{
58+
EntityDiscoveries: []core.Discovery{ // Add Location Readers so backline knows how to read entities from different sources
59+
&fs.Discovery{}, // github repo to search entities
60+
},
61+
EntityRepo: &pg.Repo{}, // use postgres implementation explicitly.
62+
KeyValStore: &kv.PgKV{}, // use postgres KV store explicitly.
63+
JobScheduler: &store.Scheduler{}, // job scheduler plugin. Basic implementation that uses KV store and Locker for scheduling and synchronizing tasks
64+
DistributedLocker: &store.Locker{}, // distributed lock plugin
65+
ScannerPlugin: &scanner.Plugin{}, // add scanner plugin to scan/read entities.
66+
},
67+
Plugins: []core.Plugin{
68+
catalog.Plugin{}, // add web interface for catalog
69+
stock.Theme{}, // add stock theme for catalog
70+
},
71+
}
72+
73+
err := application.Run()
74+
if err != nil {
75+
log.Fatal(err)
76+
}
8277
```
8378

84-
Check out the example config at `backline/cmd/config.yaml`.
85-
86-
## Customization
87-
88-
You can customize the appearance and functionality of Backline by modifying the configuration file or creating your own set of plugins.
79+
Although configuration can be done by populating plugin fields directly in the code, we will use a configuration file
80+
For sake of simplicity we will disable some security features (https, csrf, cors are enabled by default)
8981

90-
### Run separate scanner in a separate service
9182

92-
To run entity scan in a separate process:
83+
```yaml
84+
core:
85+
server:
86+
https:
87+
disabled: true
88+
csrf:
89+
disabled: true
90+
cors:
91+
disabled: true
92+
logger:
93+
level: env:LOG_LEVEL
94+
format: json
95+
repo:
96+
pg:
97+
dsn: env:PG_DSN
98+
kv:
99+
pg:
100+
dsn: env:PG_DSN
101+
lock:
102+
pg:
103+
dsn: env:PG_DSN
104+
scanner:
105+
enableScanEndpoint: true
106+
enableScanButton: true
107+
locations:
108+
fs:
109+
- "./entities"
93110

94-
```bash
95-
go run github.com/iamgoroot/backline/cmd/scan_service --config {your-config-location}/config.yaml
96111
```
97112

98-
Or run entity scan as a library:
113+
You can populate config file directly or use env variables for config values
99114

100-
```golang
101-
application := app.App{
102-
Plugins: []app.Plugin{
103-
&scanner.Plugin{},
104-
},
105-
}
106-
err := application.Run()
115+
```env
116+
PG_DSN=postgresql://postgres:postgres@localhost:5432/backline?sslmode=disable
117+
LOG_LEVEL=INFO
107118
```
108119

109-
### Run catalog UI separately
110-
111-
To run catalog UI in a separate process, run:
120+
Run the application
112121

113122
```bash
114-
go run github.com/iamgoroot/backline/cmd/webapp --config {your-config-location}/config.yaml
115-
```
116-
117-
Or run catalog UI as a library in an existing service:
118-
119-
```golang
120-
application := app.App{
121-
Plugins: []app.Plugin{
122-
catalog.Plugin{},
123-
stock.Theme{},
124-
},
125-
}
126-
127-
err := application.Run()
123+
go run main.go --config {your-config-location}/config.yaml
128124
```
129125

130-
This will start Backline with no plugins except the default UI theme and catalog plugin. No OAuth2, no scanner, no OpenAPI explorer, no discovery.
126+
Open [http://localhost:8080](http://localhost:8080) and you should see the catalog UI. Click on `Scan entities` button to start scanning entities in directory `./entities`
131127

132-
## Configuration
133-
134-
### Basics
135-
136-
Backline uses a YAML config file to configure itself. The config file allows you to specify default values and environment variable overrides.
137-
138-
```yaml
139-
key: value1
140-
key_from_env: env:ENV_VAR_NAME
141-
key_with_default: env:ENV_VAR_NAME|default_value
142-
```
143-
144-
In the example above, `key` will be set to `value1`, `key_from_env` will be set to the value of the environment variable `ENV_VAR_NAME`, and `key_with_default` will be set to the value of the environment variable `ENV_VAR_NAME` or `default_value` if the environment variable is not set.
145-
146-
### Core Config
147-
148-
Here's an example of a minimalistic core config:
149-
150-
```yaml
151-
core:
152-
server: # configure server ports, host, origins etc
153-
port: env:PORT|8080
154-
host: localhost
155-
origins:
156-
- http://localhost:8080
157-
logger: # configure logging level and format
158-
level: env:LOG_LEVEL|DEBUG
159-
format: json
160-
repo: # configure repository implementation
161-
sqlite:
162-
url: ":memory:" # use in-memory SQLite database for the simplest setup
163-
kv: # configure key-value implementation
164-
sqlite:
165-
url: ":memory:"
166-
```
128+
See more examples in `./examples` directory
167129

168130
## Core dependencies and Plugins
169131

app/go.mod

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@ module github.com/iamgoroot/backline/app
33
go 1.24.0
44

55
require (
6-
github.com/iamgoroot/backline/pkg v0.0.0-20250110021921-01b18c16a3a1
6+
github.com/iamgoroot/backline/pkg v0.0.0-20250219230517-431712432a82
77
github.com/labstack/echo/v4 v4.13.3
8-
github.com/samber/slog-echo v1.15.1
9-
golang.org/x/sync v0.11.0
8+
github.com/samber/slog-echo v1.16.1
9+
golang.org/x/sync v0.12.0
1010
)
1111

1212
require (
13-
github.com/goccy/go-yaml v1.15.23 // indirect
13+
github.com/a-h/templ v0.3.857 // indirect
14+
github.com/goccy/go-yaml v1.17.1 // indirect
1415
github.com/labstack/gommon v0.4.2 // indirect
1516
github.com/mattn/go-colorable v0.1.14 // indirect
1617
github.com/mattn/go-isatty v0.0.20 // indirect
1718
github.com/samber/lo v1.49.1 // indirect
1819
github.com/valyala/bytebufferpool v1.0.0 // indirect
1920
github.com/valyala/fasttemplate v1.2.2 // indirect
20-
go.opentelemetry.io/otel v1.34.0 // indirect
21-
go.opentelemetry.io/otel/trace v1.34.0 // indirect
22-
golang.org/x/crypto v0.33.0 // indirect
23-
golang.org/x/net v0.35.0 // indirect
24-
golang.org/x/sys v0.30.0 // indirect
25-
golang.org/x/text v0.22.0 // indirect
26-
golang.org/x/time v0.10.0 // indirect
21+
go.opentelemetry.io/otel v1.35.0 // indirect
22+
go.opentelemetry.io/otel/trace v1.35.0 // indirect
23+
golang.org/x/crypto v0.36.0 // indirect
24+
golang.org/x/net v0.38.0 // indirect
25+
golang.org/x/sys v0.31.0 // indirect
26+
golang.org/x/text v0.23.0 // indirect
27+
golang.org/x/time v0.11.0 // indirect
2728
)

app/go.sum

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
github.com/a-h/templ v0.3.857 h1:6EqcJuGZW4OL+2iZ3MD+NnIcG7nGkaQeF2Zq5kf9ZGg=
2+
github.com/a-h/templ v0.3.857/go.mod h1:qhrhAkRFubE7khxLZHsBFHfX+gWwVNKbzKeF9GlPV4M=
13
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
24
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/goccy/go-yaml v1.15.23 h1:WS0GAX1uNPDLUvLkNU2vXq6oTnsmfVFocjQ/4qA48qo=
4-
github.com/goccy/go-yaml v1.15.23/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
5-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
6-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7-
github.com/iamgoroot/backline/pkg v0.0.0-20250110021921-01b18c16a3a1 h1:X5E9C3tECBb/XdMj2Z2aRdfF6c8QUHiZKIWrJkf2+Z8=
8-
github.com/iamgoroot/backline/pkg v0.0.0-20250110021921-01b18c16a3a1/go.mod h1:eSKWBV+BjDxE4TYjIMgbqj0XdMNUPz67LyCu477qMrE=
5+
github.com/goccy/go-yaml v1.17.1 h1:LI34wktB2xEE3ONG/2Ar54+/HJVBriAGJ55PHls4YuY=
6+
github.com/goccy/go-yaml v1.17.1/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
7+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
8+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
9+
github.com/iamgoroot/backline/pkg v0.0.0-20250219230517-431712432a82 h1:HB8ulDR/IgCbr+VkRiBfWyLUABTf9MBlTAde9A9aGao=
10+
github.com/iamgoroot/backline/pkg v0.0.0-20250219230517-431712432a82/go.mod h1:XW9xiDOtvm0aUCOF7doHAPrwWqXT75LzKfO/78wILVo=
911
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
1012
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
1113
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
@@ -18,30 +20,30 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
1820
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1921
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
2022
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
21-
github.com/samber/slog-echo v1.15.1 h1:mzeQNPYPxmpehIRtgQJRgJMVvrRbZHp5D2maxSljTBw=
22-
github.com/samber/slog-echo v1.15.1/go.mod h1:K21nbusPmai/MYm8PFactmZoFctkMmkeaTdXXyvhY1c=
23+
github.com/samber/slog-echo v1.16.1 h1:5Q5IUROkFqKcu/qJM/13AP1d3gd1RS+Q/4EvKQU1fuo=
24+
github.com/samber/slog-echo v1.16.1/go.mod h1:f+B3WR06saRXcaGRZ/I/UPCECDPqTUqadRIf7TmyRhI=
2325
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
2426
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2527
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
2628
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
2729
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
2830
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
29-
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
30-
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
31-
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
32-
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
33-
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
34-
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
35-
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
36-
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
37-
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
38-
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
31+
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
32+
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
33+
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
34+
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
35+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
36+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
37+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
38+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
39+
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
40+
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
3941
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
40-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
41-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
42-
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
43-
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
44-
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
45-
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
42+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
43+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
44+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
45+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
46+
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
47+
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
4648
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4749
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

app/routes.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func setupMiddlewares(router *echo.Echo, cfg *CoreCfg) {
5353
}
5454

5555
func setupCSRFMiddleware(router *echo.Echo, cfg *CoreCfg) {
56-
if !cfg.Server.CSRF.Disabled {
56+
if cfg.Server.CSRF.Disabled {
5757
return
5858
}
5959

@@ -78,14 +78,16 @@ func setupCSRFMiddleware(router *echo.Echo, cfg *CoreCfg) {
7878
}
7979

8080
func setupCORSMiddleware(router *echo.Echo, cfg *CoreCfg) {
81-
if !cfg.Server.CORS.Disabled {
82-
router.Use(middleware.CORSWithConfig(
83-
middleware.CORSConfig{
84-
AllowCredentials: true,
85-
AllowOrigins: cfg.Server.CORS.Origins,
86-
}),
87-
)
81+
if cfg.Server.CORS.Disabled {
82+
return
8883
}
84+
85+
router.Use(middleware.CORSWithConfig(
86+
middleware.CORSConfig{
87+
AllowCredentials: true,
88+
AllowOrigins: cfg.Server.CORS.Origins,
89+
}),
90+
)
8991
}
9092

9193
func writeErrResponse(c echo.Context, status int, err error) {

cmd/distributed/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)