Skip to content

Commit

Permalink
feat: complete refactor of the codebase
Browse files Browse the repository at this point in the history
Signed-off-by: Janos Miko <[email protected]>
  • Loading branch information
janosmiko committed Jan 22, 2025
1 parent 49e5c92 commit 958db69
Show file tree
Hide file tree
Showing 22 changed files with 1,895 additions and 1,412 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.45.2
version: v1.63.1

build:
name: Build
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.18
go-version: ^1.23

- name: Check out code into the Go module directory
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
# vendor/

config.yaml
.env
.env
.env.*
17 changes: 6 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
run:
concurrency: 8
tests: true
skip-files:
- .golangci.yml
allow-parallel-runners: true


linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
# - depguard
- copyloopvar
- dogsled
- errcheck
- exhaustive
- exportloopref
# - funlen
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
Expand All @@ -28,17 +24,17 @@ linters:
- gocyclo
- godot
- godox
- goerr113
- err113
- gofmt
- goimports
- gomnd
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- lll
- misspell
- mnd
- nakedret
- nestif
- noctx
Expand All @@ -47,14 +43,13 @@ linters:
- revive
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- testpackage
- typecheck
- unconvert
- unparam
- unused
- varcheck
# - varcheck
- whitespace
# - wsl
# don't enable:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17.8-bullseye AS build
FROM golang:1.23.4-bullseye AS build

WORKDIR /go/src/github.com/janosmiko/gitea-ldap-sync/

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Available Environment Variables (find example values in [config.yaml.sample](con
|---------------------------------------|---------------------------------------------------------------|--------------------|
| `DEBUG` | Enable debug mode | `false` |
| `GITEA_BASE_URL` | Gitea baseURL in `https://[email protected]` format. | `""` |
| `GITEA_USER` | Gitea admin username | `""` |
| `GITEA_USER` | Gitea admin username | `"root"` |
| `GITEA_TOKEN` | Gitea admin user token | `""` |
| `LDAP_URL` | LDAP connection URL | `""` |
| `LDAP_PORT` | LDAP connection port | `389` |
Expand Down Expand Up @@ -82,6 +82,7 @@ Available Environment Variables (find example values in [config.yaml.sample](con
| `LDAP_EXCLUDE_SUBGROUPS_REGEX` | Exclude groups from sync (regular expression) | `""` |
| `LDAP_TRIM_PARENT_NAME` | Trim parent name from subgroup name | `false` |
| `LDAP_SUBGROUP_SEPARATOR` | Trim parent name from subgroup name by this separator | `"/"` |
| `CRON_ENABLED` | Enabled cron scheduler | `true` |
| `CRON_TIMER` | Configure the schedule of the sync (cron format) | `"@every 1m"` |
| `SYNC_CONFIG_CREATE_GROUPS` | Create non-existing groups in Gitea. | `true` |
| `SYNC_CONFIG_FULL_SYNC` | Delete groups from Gitea if they are not existing in LDAP | `false` |
Expand Down
183 changes: 0 additions & 183 deletions config.go

This file was deleted.

1 change: 1 addition & 0 deletions config.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ ldap:
subgroup_separator: "/"

cron_timer: '@every 1m'
cron_enabled: true

sync_config:
# If CreateUsers is set to true, the process will create Users in Gitea.
Expand Down
2 changes: 1 addition & 1 deletion deploy/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
- name: GITEA_BASE_URL
value: https://[email protected]
- name: GITEA_USER
value: ""
value: "root"
- name: GITEA_TOKEN
valueFrom:
secretKeyRef:
Expand Down
Loading

0 comments on commit 958db69

Please sign in to comment.