From ff31abe66cfd46f8cccca00ad708529e4d920144 Mon Sep 17 00:00:00 2001 From: James Read Date: Sat, 22 Mar 2025 01:06:59 +0000 Subject: [PATCH] refactor: Project directories (#541) --- .github/workflows/build-buf.yml | 10 +++- .github/workflows/build-snapshot.yml | 8 +-- .github/workflows/build-tag.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/codestyle.yml | 2 +- .gitignore | 10 ++-- .goreleaser.yml | 8 +-- Makefile | 52 ++++--------------- generate.go | 3 -- integration-tests/runner.mjs | 4 +- proto/buf.gen.yaml | 6 +-- proto/buf.lock | 8 +-- proto/buf.yaml | 2 +- .air.toml => service/.air.toml | 2 +- service/Makefile | 48 +++++++++++++++++ service/generate.go | 3 ++ go.mod => service/go.mod | 0 go.sum => service/go.sum | 0 {internal => service/internal}/acl/acl.go | 0 .../internal}/config/config.go | 0 .../internal}/config/config_helpers.go | 0 .../internal}/config/config_helpers_test.go | 0 .../internal}/config/config_reloader.go | 0 .../internal}/config/config_test.go | 0 .../internal}/config/emoji.go | 0 .../internal}/config/emoji_test.go | 0 .../internal}/config/sanitize.go | 0 .../internal}/config/sanitize_test.go | 0 {internal => service/internal}/cors/cors.go | 0 .../internal}/cors/cors_test.go | 0 .../internal}/entityfiles/entityfiles.go | 0 .../internal}/executor/arguments.go | 0 .../internal}/executor/arguments_test.go | 0 .../internal}/executor/executor.go | 0 .../internal}/executor/executor_actions.go | 0 .../internal}/executor/executor_test.go | 0 .../internal}/executor/executor_unix.go | 0 .../internal}/executor/executor_windows.go | 0 .../filehelper/file_change_notify.go | 0 .../internal}/filehelper/file_touch.go | 0 .../internal}/filehelper/file_write.go | 0 .../internal}/grpcapi/grpcApi.go | 0 .../internal}/grpcapi/grpcApiActions.go | 0 .../internal}/grpcapi/grpcApiDashboard.go | 0 .../grpcapi/grpcApiDashboardEntities.go | 0 .../internal}/grpcapi/grpcApi_test.go | 0 .../internal}/grpcapi/local_user_login.go | 0 .../internal}/httpservers/httpServer.go | 0 .../internal}/httpservers/prometheus.go | 0 .../internal}/httpservers/restapi.go | 0 .../internal}/httpservers/restapi_auth.go | 0 .../internal}/httpservers/restapi_auth_jwt.go | 0 .../httpservers/restapi_auth_jwt_test.go | 0 .../httpservers/restapi_auth_local.go | 0 .../httpservers/restapi_auth_oauth2.go | 0 .../restapi_auth_oauth2_providers.go | 0 .../internal}/httpservers/restapi_test.go | 0 .../internal}/httpservers/singleFrontend.go | 0 .../internal}/httpservers/webuiServer.go | 0 .../internal}/httpservers/webuiServer_test.go | 2 +- .../internal}/installationinfo/buildinfo.go | 0 .../internal}/installationinfo/init.go | 0 .../internal}/installationinfo/runtimeinfo.go | 0 .../internal}/installationinfo/sosreport.go | 0 .../internal}/oncalendarfile/calendar.go | 0 {internal => service/internal}/oncron/cron.go | 0 .../internal}/onfileindir/fileindir.go | 0 .../internal}/onstartup/startup.go | 0 .../internal}/stringvariables/entities.go | 0 .../stringvariables/entities_test.go | 0 .../internal}/stringvariables/map.go | 0 .../internal}/stringvariables/map_test.go | 0 .../internal}/updatecheck/updateCheck.go | 0 .../internal}/websocket/websocket.go | 0 {cmd/OliveTin => service}/main.go | 1 + tools.go => service/tools.go | 0 76 files changed, 100 insertions(+), 73 deletions(-) delete mode 100644 generate.go rename .air.toml => service/.air.toml (91%) create mode 100644 service/Makefile create mode 100644 service/generate.go rename go.mod => service/go.mod (100%) rename go.sum => service/go.sum (100%) rename {internal => service/internal}/acl/acl.go (100%) rename {internal => service/internal}/config/config.go (100%) rename {internal => service/internal}/config/config_helpers.go (100%) rename {internal => service/internal}/config/config_helpers_test.go (100%) rename {internal => service/internal}/config/config_reloader.go (100%) rename {internal => service/internal}/config/config_test.go (100%) rename {internal => service/internal}/config/emoji.go (100%) rename {internal => service/internal}/config/emoji_test.go (100%) rename {internal => service/internal}/config/sanitize.go (100%) rename {internal => service/internal}/config/sanitize_test.go (100%) rename {internal => service/internal}/cors/cors.go (100%) rename {internal => service/internal}/cors/cors_test.go (100%) rename {internal => service/internal}/entityfiles/entityfiles.go (100%) rename {internal => service/internal}/executor/arguments.go (100%) rename {internal => service/internal}/executor/arguments_test.go (100%) rename {internal => service/internal}/executor/executor.go (100%) rename {internal => service/internal}/executor/executor_actions.go (100%) rename {internal => service/internal}/executor/executor_test.go (100%) rename {internal => service/internal}/executor/executor_unix.go (100%) rename {internal => service/internal}/executor/executor_windows.go (100%) rename {internal => service/internal}/filehelper/file_change_notify.go (100%) rename {internal => service/internal}/filehelper/file_touch.go (100%) rename {internal => service/internal}/filehelper/file_write.go (100%) rename {internal => service/internal}/grpcapi/grpcApi.go (100%) rename {internal => service/internal}/grpcapi/grpcApiActions.go (100%) rename {internal => service/internal}/grpcapi/grpcApiDashboard.go (100%) rename {internal => service/internal}/grpcapi/grpcApiDashboardEntities.go (100%) rename {internal => service/internal}/grpcapi/grpcApi_test.go (100%) rename {internal => service/internal}/grpcapi/local_user_login.go (100%) rename {internal => service/internal}/httpservers/httpServer.go (100%) rename {internal => service/internal}/httpservers/prometheus.go (100%) rename {internal => service/internal}/httpservers/restapi.go (100%) rename {internal => service/internal}/httpservers/restapi_auth.go (100%) rename {internal => service/internal}/httpservers/restapi_auth_jwt.go (100%) rename {internal => service/internal}/httpservers/restapi_auth_jwt_test.go (100%) rename {internal => service/internal}/httpservers/restapi_auth_local.go (100%) rename {internal => service/internal}/httpservers/restapi_auth_oauth2.go (100%) rename {internal => service/internal}/httpservers/restapi_auth_oauth2_providers.go (100%) rename {internal => service/internal}/httpservers/restapi_test.go (100%) rename {internal => service/internal}/httpservers/singleFrontend.go (100%) rename {internal => service/internal}/httpservers/webuiServer.go (100%) rename {internal => service/internal}/httpservers/webuiServer_test.go (83%) rename {internal => service/internal}/installationinfo/buildinfo.go (100%) rename {internal => service/internal}/installationinfo/init.go (100%) rename {internal => service/internal}/installationinfo/runtimeinfo.go (100%) rename {internal => service/internal}/installationinfo/sosreport.go (100%) rename {internal => service/internal}/oncalendarfile/calendar.go (100%) rename {internal => service/internal}/oncron/cron.go (100%) rename {internal => service/internal}/onfileindir/fileindir.go (100%) rename {internal => service/internal}/onstartup/startup.go (100%) rename {internal => service/internal}/stringvariables/entities.go (100%) rename {internal => service/internal}/stringvariables/entities_test.go (100%) rename {internal => service/internal}/stringvariables/map.go (100%) rename {internal => service/internal}/stringvariables/map_test.go (100%) rename {internal => service/internal}/updatecheck/updateCheck.go (100%) rename {internal => service/internal}/websocket/websocket.go (100%) rename {cmd/OliveTin => service}/main.go (99%) rename tools.go => service/tools.go (100%) diff --git a/.github/workflows/build-buf.yml b/.github/workflows/build-buf.yml index 7e4067f..397fe3e 100644 --- a/.github/workflows/build-buf.yml +++ b/.github/workflows/build-buf.yml @@ -1,6 +1,9 @@ name: Buf CI on: push: + paths: + - 'proto/**' + pull_request: types: [opened, synchronize, reopened, labeled, unlabeled] delete: @@ -16,13 +19,16 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: 'service/go.mod' cache: true - name: grpc run: make -w grpc - - uses: bufbuild/buf-action@v1 + - name: make service + run: make -w service + + - uses: bufbuild/buf-action@v1.1.0 with: token: ${{ secrets.BUF_TOKEN }} # Change setup_only to true if you only want to set up the Action and not execute other commands. diff --git a/.github/workflows/build-snapshot.yml b/.github/workflows/build-snapshot.yml index 3fa4bc9..d2be0e2 100644 --- a/.github/workflows/build-snapshot.yml +++ b/.github/workflows/build-snapshot.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: 'service/go.mod' cache: true - name: Print go version @@ -40,14 +40,14 @@ jobs: - name: grpc run: make -w grpc - - name: make daemon - run: make -w daemon-compile-x64-lin + - name: make service + run: make -w service - name: make webui run: make -w webui-dist - name: unit tests - run: make -w daemon-unittests + run: make -w service-unittests - name: integration tests run: cd integration-tests && make -w diff --git a/.github/workflows/build-tag.yml b/.github/workflows/build-tag.yml index cfbc4ea..58a174c 100644 --- a/.github/workflows/build-tag.yml +++ b/.github/workflows/build-tag.yml @@ -31,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: 'service/go.mod' cache: true - name: Print go version diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9de7b6b..e12a13d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -47,7 +47,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: 'service/go.mod' cache: true - name: grpc diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 38f7a9c..c9cc592 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: 'service/go.mod' cache: true - name: Print go version diff --git a/.gitignore b/.gitignore index 7cc4079..a0d7674 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ **/*.swp **/*.swo -gen/ -/OliveTin -/OliveTin.armhf -/OliveTin.exe -reports +service/gen/ +service/OliveTin +service/OliveTin.armhf +service/OliveTin.exe +service/reports releases/ dist/ installation-id.txt diff --git a/.goreleaser.yml b/.goreleaser.yml index bbb5a6e..16259ae 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -2,12 +2,14 @@ project_name: OliveTin version: 2 before: hooks: - - go mod download - - go generate ./... + - make service-prep builds: - env: - CGO_ENABLED=0 + binary: OliveTin + main: main.go + dir: service goos: - linux - windows @@ -25,8 +27,6 @@ builds: - 6 - 7 - main: cmd/OliveTin/main.go - ignore: - goos: darwin goarch: arm # Mac does not work on [32bit] arm diff --git a/Makefile b/Makefile index 55fa012..9a7ccb6 100644 --- a/Makefile +++ b/Makefile @@ -2,52 +2,22 @@ define delete-files python -c "import shutil;shutil.rmtree('$(1)', ignore_errors=True)" endef -compile: daemon-compile-currentenv +service: + $(MAKE) -wC service -daemon-compile-currentenv: - go build github.com/OliveTin/OliveTin/cmd/OliveTin - -daemon-compile-armhf: - go env -w GOARCH=arm GOARM=6 - go build -o OliveTin.armhf github.com/OliveTin/OliveTin/cmd/OliveTin - go env -u GOARCH GOARM - -daemon-compile-x64-lin: - go env -w GOOS=linux - go build -o OliveTin github.com/OliveTin/OliveTin/cmd/OliveTin - go env -u GOOS - -daemon-compile-x64-win: - go env -w GOOS=windows GOARCH=amd64 - go build -o OliveTin.exe github.com/OliveTin/OliveTin/cmd/OliveTin - go env -u GOOS GOARCH - -daemon-compile: daemon-compile-armhf daemon-compile-x64-lin daemon-compile-x64-win - -daemon-codestyle: - go fmt ./... - go vet ./... - gocyclo -over 4 cmd internal - gocritic check ./... - -daemon-unittests: - $(call delete-files,reports) - mkdir reports - go test ./... -coverprofile reports/unittests.out - go tool cover -html=reports/unittests.out -o reports/unittests.html +service-prep: + $(MAKE) -wC service prep +service-unittests: + $(MAKE) -wC service unittests it: - cd integration-tests && make + $(MAKE) -wC integration-tests go-tools: - go install "github.com/bufbuild/buf/cmd/buf" - go install "github.com/fzipp/gocyclo/cmd/gocyclo" - go install "github.com/go-critic/go-critic/cmd/gocritic" - go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" - go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" - go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc" - go install "google.golang.org/protobuf/cmd/protoc-gen-go" + $(MAKE) -wC service go-tools + +proto: grpc grpc: go-tools $(MAKE) -wC proto @@ -98,4 +68,4 @@ clean: $(call delete-files,reports) $(call delete-files,gen) -.PHONY: grpc +.PHONY: grpc proto service diff --git a/generate.go b/generate.go deleted file mode 100644 index 1982f8b..0000000 --- a/generate.go +++ /dev/null @@ -1,3 +0,0 @@ -//go:generate make grpc - -package main diff --git a/integration-tests/runner.mjs b/integration-tests/runner.mjs index 5781175..6993a29 100644 --- a/integration-tests/runner.mjs +++ b/integration-tests/runner.mjs @@ -35,10 +35,10 @@ class OliveTinTestRunnerStartLocalProcess extends OliveTinTestRunner { async start (cfg) { let stdout = "" let stderr = "" - + console.log(" OliveTin starting local process...") - this.ot = spawn('./../OliveTin', ['-configdir', 'configs/' + cfg + '/']) + this.ot = spawn('./../service/OliveTin', ['-configdir', 'configs/' + cfg + '/']) let logStdout = false diff --git a/proto/buf.gen.yaml b/proto/buf.gen.yaml index 1bb0c61..2e3b737 100644 --- a/proto/buf.gen.yaml +++ b/proto/buf.gen.yaml @@ -1,15 +1,15 @@ version: v1 plugins: - name: go - out: ../gen/grpc/ + out: ../service/gen/grpc/ opt: paths=source_relative - name: go-grpc - out: ../gen/grpc/ + out: ../service/gen/grpc/ opt: paths=source_relative,require_unimplemented_servers=false - name: grpc-gateway - out: ../gen/grpc/ + out: ../service/gen/grpc/ opt: paths=source_relative # - name: swagger diff --git a/proto/buf.lock b/proto/buf.lock index 126874a..73ebfcf 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -1,6 +1,8 @@ # Generated by buf. DO NOT EDIT. -version: v2 +version: v1 deps: - - name: buf.build/googleapis/googleapis + - remote: buf.build + owner: googleapis + repository: googleapis commit: 751cbe31638d43a9bfb6162cd2352e67 - digest: b5:51ba5c31f244fd74420f0e66d13f2b5dd6024dcfe1a29dc45bd8f6e61c1444c828b9add9e7dd25a4513ebbee8097a970e0712a2e2cd955c2d60cf8905204f51a + digest: shake256:87f55470d9d124e2d1dedfe0231221f4ed7efbc55bc5268917c678e2d9b9c41573a7f9a557f6d8539044524d9fc5ca8fbb7db05eb81379d168285d76b57eb8a4 diff --git a/proto/buf.yaml b/proto/buf.yaml index 16dcb8e..b809ea0 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,4 +1,4 @@ -version: v2 +version: v1 deps: - buf.build/googleapis/googleapis lint: diff --git a/.air.toml b/service/.air.toml similarity index 91% rename from .air.toml rename to service/.air.toml index f1f88db..f744ef9 100644 --- a/.air.toml +++ b/service/.air.toml @@ -5,7 +5,7 @@ tmp_dir = "tmp" [build] args_bin = [] bin = "./OliveTin" - cmd = "go build -o OliveTin github.com/OliveTin/OliveTin/cmd/OliveTin" + cmd = "go build -o OliveTin" delay = 1 exclude_dir = ["assets", "tmp", "vendor", "testdata", "webui.dev", "webui"] exclude_file = [] diff --git a/service/Makefile b/service/Makefile new file mode 100644 index 0000000..b13f6cc --- /dev/null +++ b/service/Makefile @@ -0,0 +1,48 @@ +define delete-files + python -c "import shutil;shutil.rmtree('$(1)', ignore_errors=True)" +endef + +compile-currentenv: + go build + +prep: + go mod download + go generate ./... + +compile-armhf: + go env -w GOARCH=arm GOARM=6 + go build -o OliveTin.armhf + go env -u GOARCH GOARM + +compile-x64-lin: + go env -w GOOS=linux + go build -o OliveTin + go env -u GOOS + +compile-x64-win: + go env -w GOOS=windows GOARCH=amd64 + go build -o OliveTin.exe + go env -u GOOS GOARCH + +compile: compile-armhf compile-x64-lin compile-x64-win + +codestyle: + go fmt ./... + go vet ./... + gocyclo -over 4 internal + gocritic check ./... + +unittests: + $(call delete-files,reports) + mkdir reports + go test ./... -coverprofile reports/unittests.out + go tool cover -html=reports/unittests.out -o reports/unittests.html + +go-tools: + go install "github.com/bufbuild/buf/cmd/buf" + go install "github.com/fzipp/gocyclo/cmd/gocyclo" + go install "github.com/go-critic/go-critic/cmd/gocritic" + go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway" + go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2" + go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc" + go install "google.golang.org/protobuf/cmd/protoc-gen-go" diff --git a/service/generate.go b/service/generate.go new file mode 100644 index 0000000..ebf847f --- /dev/null +++ b/service/generate.go @@ -0,0 +1,3 @@ +//go:generate make -wC ../ + +package main diff --git a/go.mod b/service/go.mod similarity index 100% rename from go.mod rename to service/go.mod diff --git a/go.sum b/service/go.sum similarity index 100% rename from go.sum rename to service/go.sum diff --git a/internal/acl/acl.go b/service/internal/acl/acl.go similarity index 100% rename from internal/acl/acl.go rename to service/internal/acl/acl.go diff --git a/internal/config/config.go b/service/internal/config/config.go similarity index 100% rename from internal/config/config.go rename to service/internal/config/config.go diff --git a/internal/config/config_helpers.go b/service/internal/config/config_helpers.go similarity index 100% rename from internal/config/config_helpers.go rename to service/internal/config/config_helpers.go diff --git a/internal/config/config_helpers_test.go b/service/internal/config/config_helpers_test.go similarity index 100% rename from internal/config/config_helpers_test.go rename to service/internal/config/config_helpers_test.go diff --git a/internal/config/config_reloader.go b/service/internal/config/config_reloader.go similarity index 100% rename from internal/config/config_reloader.go rename to service/internal/config/config_reloader.go diff --git a/internal/config/config_test.go b/service/internal/config/config_test.go similarity index 100% rename from internal/config/config_test.go rename to service/internal/config/config_test.go diff --git a/internal/config/emoji.go b/service/internal/config/emoji.go similarity index 100% rename from internal/config/emoji.go rename to service/internal/config/emoji.go diff --git a/internal/config/emoji_test.go b/service/internal/config/emoji_test.go similarity index 100% rename from internal/config/emoji_test.go rename to service/internal/config/emoji_test.go diff --git a/internal/config/sanitize.go b/service/internal/config/sanitize.go similarity index 100% rename from internal/config/sanitize.go rename to service/internal/config/sanitize.go diff --git a/internal/config/sanitize_test.go b/service/internal/config/sanitize_test.go similarity index 100% rename from internal/config/sanitize_test.go rename to service/internal/config/sanitize_test.go diff --git a/internal/cors/cors.go b/service/internal/cors/cors.go similarity index 100% rename from internal/cors/cors.go rename to service/internal/cors/cors.go diff --git a/internal/cors/cors_test.go b/service/internal/cors/cors_test.go similarity index 100% rename from internal/cors/cors_test.go rename to service/internal/cors/cors_test.go diff --git a/internal/entityfiles/entityfiles.go b/service/internal/entityfiles/entityfiles.go similarity index 100% rename from internal/entityfiles/entityfiles.go rename to service/internal/entityfiles/entityfiles.go diff --git a/internal/executor/arguments.go b/service/internal/executor/arguments.go similarity index 100% rename from internal/executor/arguments.go rename to service/internal/executor/arguments.go diff --git a/internal/executor/arguments_test.go b/service/internal/executor/arguments_test.go similarity index 100% rename from internal/executor/arguments_test.go rename to service/internal/executor/arguments_test.go diff --git a/internal/executor/executor.go b/service/internal/executor/executor.go similarity index 100% rename from internal/executor/executor.go rename to service/internal/executor/executor.go diff --git a/internal/executor/executor_actions.go b/service/internal/executor/executor_actions.go similarity index 100% rename from internal/executor/executor_actions.go rename to service/internal/executor/executor_actions.go diff --git a/internal/executor/executor_test.go b/service/internal/executor/executor_test.go similarity index 100% rename from internal/executor/executor_test.go rename to service/internal/executor/executor_test.go diff --git a/internal/executor/executor_unix.go b/service/internal/executor/executor_unix.go similarity index 100% rename from internal/executor/executor_unix.go rename to service/internal/executor/executor_unix.go diff --git a/internal/executor/executor_windows.go b/service/internal/executor/executor_windows.go similarity index 100% rename from internal/executor/executor_windows.go rename to service/internal/executor/executor_windows.go diff --git a/internal/filehelper/file_change_notify.go b/service/internal/filehelper/file_change_notify.go similarity index 100% rename from internal/filehelper/file_change_notify.go rename to service/internal/filehelper/file_change_notify.go diff --git a/internal/filehelper/file_touch.go b/service/internal/filehelper/file_touch.go similarity index 100% rename from internal/filehelper/file_touch.go rename to service/internal/filehelper/file_touch.go diff --git a/internal/filehelper/file_write.go b/service/internal/filehelper/file_write.go similarity index 100% rename from internal/filehelper/file_write.go rename to service/internal/filehelper/file_write.go diff --git a/internal/grpcapi/grpcApi.go b/service/internal/grpcapi/grpcApi.go similarity index 100% rename from internal/grpcapi/grpcApi.go rename to service/internal/grpcapi/grpcApi.go diff --git a/internal/grpcapi/grpcApiActions.go b/service/internal/grpcapi/grpcApiActions.go similarity index 100% rename from internal/grpcapi/grpcApiActions.go rename to service/internal/grpcapi/grpcApiActions.go diff --git a/internal/grpcapi/grpcApiDashboard.go b/service/internal/grpcapi/grpcApiDashboard.go similarity index 100% rename from internal/grpcapi/grpcApiDashboard.go rename to service/internal/grpcapi/grpcApiDashboard.go diff --git a/internal/grpcapi/grpcApiDashboardEntities.go b/service/internal/grpcapi/grpcApiDashboardEntities.go similarity index 100% rename from internal/grpcapi/grpcApiDashboardEntities.go rename to service/internal/grpcapi/grpcApiDashboardEntities.go diff --git a/internal/grpcapi/grpcApi_test.go b/service/internal/grpcapi/grpcApi_test.go similarity index 100% rename from internal/grpcapi/grpcApi_test.go rename to service/internal/grpcapi/grpcApi_test.go diff --git a/internal/grpcapi/local_user_login.go b/service/internal/grpcapi/local_user_login.go similarity index 100% rename from internal/grpcapi/local_user_login.go rename to service/internal/grpcapi/local_user_login.go diff --git a/internal/httpservers/httpServer.go b/service/internal/httpservers/httpServer.go similarity index 100% rename from internal/httpservers/httpServer.go rename to service/internal/httpservers/httpServer.go diff --git a/internal/httpservers/prometheus.go b/service/internal/httpservers/prometheus.go similarity index 100% rename from internal/httpservers/prometheus.go rename to service/internal/httpservers/prometheus.go diff --git a/internal/httpservers/restapi.go b/service/internal/httpservers/restapi.go similarity index 100% rename from internal/httpservers/restapi.go rename to service/internal/httpservers/restapi.go diff --git a/internal/httpservers/restapi_auth.go b/service/internal/httpservers/restapi_auth.go similarity index 100% rename from internal/httpservers/restapi_auth.go rename to service/internal/httpservers/restapi_auth.go diff --git a/internal/httpservers/restapi_auth_jwt.go b/service/internal/httpservers/restapi_auth_jwt.go similarity index 100% rename from internal/httpservers/restapi_auth_jwt.go rename to service/internal/httpservers/restapi_auth_jwt.go diff --git a/internal/httpservers/restapi_auth_jwt_test.go b/service/internal/httpservers/restapi_auth_jwt_test.go similarity index 100% rename from internal/httpservers/restapi_auth_jwt_test.go rename to service/internal/httpservers/restapi_auth_jwt_test.go diff --git a/internal/httpservers/restapi_auth_local.go b/service/internal/httpservers/restapi_auth_local.go similarity index 100% rename from internal/httpservers/restapi_auth_local.go rename to service/internal/httpservers/restapi_auth_local.go diff --git a/internal/httpservers/restapi_auth_oauth2.go b/service/internal/httpservers/restapi_auth_oauth2.go similarity index 100% rename from internal/httpservers/restapi_auth_oauth2.go rename to service/internal/httpservers/restapi_auth_oauth2.go diff --git a/internal/httpservers/restapi_auth_oauth2_providers.go b/service/internal/httpservers/restapi_auth_oauth2_providers.go similarity index 100% rename from internal/httpservers/restapi_auth_oauth2_providers.go rename to service/internal/httpservers/restapi_auth_oauth2_providers.go diff --git a/internal/httpservers/restapi_test.go b/service/internal/httpservers/restapi_test.go similarity index 100% rename from internal/httpservers/restapi_test.go rename to service/internal/httpservers/restapi_test.go diff --git a/internal/httpservers/singleFrontend.go b/service/internal/httpservers/singleFrontend.go similarity index 100% rename from internal/httpservers/singleFrontend.go rename to service/internal/httpservers/singleFrontend.go diff --git a/internal/httpservers/webuiServer.go b/service/internal/httpservers/webuiServer.go similarity index 100% rename from internal/httpservers/webuiServer.go rename to service/internal/httpservers/webuiServer.go diff --git a/internal/httpservers/webuiServer_test.go b/service/internal/httpservers/webuiServer_test.go similarity index 83% rename from internal/httpservers/webuiServer_test.go rename to service/internal/httpservers/webuiServer_test.go index 57aab5a..6051be4 100644 --- a/internal/httpservers/webuiServer_test.go +++ b/service/internal/httpservers/webuiServer_test.go @@ -14,5 +14,5 @@ func TestGetWebuiDir(t *testing.T) { dir := findWebuiDir() - assert.Equal(t, "./webui", dir, "Finding the webui dir") + assert.Equal(t, "../webui/", dir, "Finding the webui dir") } diff --git a/internal/installationinfo/buildinfo.go b/service/internal/installationinfo/buildinfo.go similarity index 100% rename from internal/installationinfo/buildinfo.go rename to service/internal/installationinfo/buildinfo.go diff --git a/internal/installationinfo/init.go b/service/internal/installationinfo/init.go similarity index 100% rename from internal/installationinfo/init.go rename to service/internal/installationinfo/init.go diff --git a/internal/installationinfo/runtimeinfo.go b/service/internal/installationinfo/runtimeinfo.go similarity index 100% rename from internal/installationinfo/runtimeinfo.go rename to service/internal/installationinfo/runtimeinfo.go diff --git a/internal/installationinfo/sosreport.go b/service/internal/installationinfo/sosreport.go similarity index 100% rename from internal/installationinfo/sosreport.go rename to service/internal/installationinfo/sosreport.go diff --git a/internal/oncalendarfile/calendar.go b/service/internal/oncalendarfile/calendar.go similarity index 100% rename from internal/oncalendarfile/calendar.go rename to service/internal/oncalendarfile/calendar.go diff --git a/internal/oncron/cron.go b/service/internal/oncron/cron.go similarity index 100% rename from internal/oncron/cron.go rename to service/internal/oncron/cron.go diff --git a/internal/onfileindir/fileindir.go b/service/internal/onfileindir/fileindir.go similarity index 100% rename from internal/onfileindir/fileindir.go rename to service/internal/onfileindir/fileindir.go diff --git a/internal/onstartup/startup.go b/service/internal/onstartup/startup.go similarity index 100% rename from internal/onstartup/startup.go rename to service/internal/onstartup/startup.go diff --git a/internal/stringvariables/entities.go b/service/internal/stringvariables/entities.go similarity index 100% rename from internal/stringvariables/entities.go rename to service/internal/stringvariables/entities.go diff --git a/internal/stringvariables/entities_test.go b/service/internal/stringvariables/entities_test.go similarity index 100% rename from internal/stringvariables/entities_test.go rename to service/internal/stringvariables/entities_test.go diff --git a/internal/stringvariables/map.go b/service/internal/stringvariables/map.go similarity index 100% rename from internal/stringvariables/map.go rename to service/internal/stringvariables/map.go diff --git a/internal/stringvariables/map_test.go b/service/internal/stringvariables/map_test.go similarity index 100% rename from internal/stringvariables/map_test.go rename to service/internal/stringvariables/map_test.go diff --git a/internal/updatecheck/updateCheck.go b/service/internal/updatecheck/updateCheck.go similarity index 100% rename from internal/updatecheck/updateCheck.go rename to service/internal/updatecheck/updateCheck.go diff --git a/internal/websocket/websocket.go b/service/internal/websocket/websocket.go similarity index 100% rename from internal/websocket/websocket.go rename to service/internal/websocket/websocket.go diff --git a/cmd/OliveTin/main.go b/service/main.go similarity index 99% rename from cmd/OliveTin/main.go rename to service/main.go index 1c6b091..249dad8 100644 --- a/cmd/OliveTin/main.go +++ b/service/main.go @@ -108,6 +108,7 @@ func initViperConfig(configDir string) { viper.SetConfigName("config.yaml") viper.SetConfigType("yaml") viper.AddConfigPath(configDir) + viper.AddConfigPath("../") viper.AddConfigPath("/config") // For containers. viper.AddConfigPath("/etc/OliveTin/") diff --git a/tools.go b/service/tools.go similarity index 100% rename from tools.go rename to service/tools.go