Refactor server configuration and internal module structure#147
Merged
akiidjk merged 3 commits intorefactor/configfrom Apr 1, 2026
Merged
Refactor server configuration and internal module structure#147akiidjk merged 3 commits intorefactor/configfrom
akiidjk merged 3 commits intorefactor/configfrom
Conversation
Update go.work to reference new internal paths and add server/internal/config go.mod Refactor config package: use sharedconfig.Shared for SharedConfig and add a Config struct to hold flagTTL
Convert flag status from string to int across models, database schema, queries, protocols and tests Add a ConfigManager singleton for server configuration and inject it into Runner, handlers and related components Update sqlc config and internal package paths, add controllers module, and misc refactors (slice append optimization, import tweaks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Server Config management refactor
Refactor server config management based on the #146 PR by @giovanni-iannaccone, i replicated the same implementation used in the client and also change the Statuses handling by int with enum (#142), updated also tests based on new implementation and change the method to handling VERSION in the build
COPILOT SUMMARY
This pull request introduces significant refactoring and modernization to the CookieFarm client, especially around API handling, configuration management, and CI/CD improvements. The main highlights include a complete rewrite of the client API HTTP logic, a major cleanup and simplification of the configuration command handling, enhancements to the Dockerfile for improved security, and updates to CI workflows and linting rules.
API Client Refactor and Configuration Handling:
Clientstruct inapi/http.goto encapsulate HTTP logic, token management, and request methods (get,postJSON,postForm), replacing the previous ad-hoc approach and simplifying error handling and authentication. ([[1]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-8cfda5b1b8a36f6a2b7bcba8899b9d762c82b73c4f0c81466e9d261e86912286R1-R113),[[2]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-541421de56f950a17be957aef633c8e0ba38e120dbaa26564402391f8388cb2aL1-R100))cmd/config.gotocmd/args.go, streamlined flag handling, and improved the update, login, logout, and show logic to use a singleton config instance and more idiomatic Go patterns. ([[1]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-799c55e86d41152eaf3a3e34e1433c04ac86dc52902c11fc36192fd5dee5ce10L1),[[2]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-799c55e86d41152eaf3a3e34e1433c04ac86dc52902c11fc36192fd5dee5ce10L16-R125),[[3]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-799c55e86d41152eaf3a3e34e1433c04ac86dc52902c11fc36192fd5dee5ce10L152-R135),[[4]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-799c55e86d41152eaf3a3e34e1433c04ac86dc52902c11fc36192fd5dee5ce10L161-R152))Security and Docker Improvements:
vincenzino), and set the container to run as this user for improved security. Also fixed the build context to only copy the server directory. ([cookiefarm/DockerfileL9-R20](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-f3723ada23514f7af4b71d258d2c2f5a8cbd08a808429e5198d38ef4a241130fL9-R20))CI/CD and Linting Enhancements:
.github/workflows/sonar.ymlto include running Go tests with coverage before SonarQube analysis, fixed shallow clone issues, and added a SonarQube quality gate step. ([[1]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-9a1c250ec072fc76ad44435cd9462d5693ea81f304d650922d3c2792bef267c2L1-R1),[[2]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-9a1c250ec072fc76ad44435cd9462d5693ea81f304d650922d3c2792bef267c2L13-R48))dupl,zerologlint,whitespace) and configured thedupllinter with a threshold in.golangci.ymlfor better code quality enforcement. ([[1]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-6179837f7df53a6f05c522b6b7bb566d484d5465d9894fb04910dd08bb40dcc9R30),[[2]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-6179837f7df53a6f05c522b6b7bb566d484d5465d9894fb04910dd08bb40dcc9L59-R61),[[3]](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-6179837f7df53a6f05c522b6b7bb566d484d5465d9894fb04910dd08bb40dcc9R83-R85))Dependency Updates:
github.com/stretchr/testifyas a test dependency ingo.modfor improved testing capabilities. ([cookiefarm/client/api/go.modR12](https://github.com/ByteTheCookies/CookieFarm/pull/147/files#diff-3adfb85d1ae8e32ff5c1112b6803c559264f4bb187d856dd58dbff4a7c8c2c68R12))These changes collectively make the client more maintainable, secure, and robust, while also improving developer experience and code quality enforcement.