Commit graph

87 commits

Author SHA1 Message Date
hhftechnologies
d48d5b8a28 lint-error fixes.
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Tests / Run Tests (push) Waiting to run
Tests / Lint (push) Waiting to run
Tests / Build (push) Blocked by required conditions
2026-04-20 19:52:56 +05:30
hhftechnologies
8c1ba7192f fixes-lint-errors
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Tests / Run Tests (push) Has been cancelled
Tests / Lint (push) Has been cancelled
Tests / Build (push) Has been cancelled
2026-04-16 08:26:02 +05:30
hhftechnologies
d8f5b44d56 Refactor defers, switches, and small fixes
Replace direct defers that ignored returned errors with explicit defer func() { _ = ... }() and use blank-assignment for Setenv/RemoveAll/Close to satisfy error-checking and ensure closures run. Convert several if-else chains to switch for clarity (status filter, test server path matching), switch strings.Replace to strings.ReplaceAll, and normalize some error/log message casing. These changes are minor refactors across handlers, services, database and tests to improve lint compliance and readability.
2026-04-16 08:02:03 +05:30
hhftechnologies
93fd97772d Add env-driven Traefik URL discovery and fallbacks
Introduce services/traefik_urls.go to centralize Traefik URL helpers and add opt-in fallback probing via TRAEFIK_API_FALLBACK_URLS. defaultTraefikURL now prefers TRAEFIK_API_URL before falling back to http://traefik:8080. main.go only auto-discovers the Traefik API when TRAEFIK_API_URL is empty and TRAEFIK_API_DISCOVER=true. Service fetchers were refactored to use fallbackTraefikURLsFromEnv (and return an error if no fallbacks are configured) and a noisy non-critical endpoint warning log was removed. These changes make fallback probing explicit and avoid silently overriding user-provided TRAEFIK_API_URL.
2026-04-16 04:12:57 +05:30
hhftechnologies
caabae1ab1 Upgrade Go/toolchain and deps; add rollback helper
Bump Go versions in CI, Dockerfile and go.mod/toolchain to 1.25.x and update several module dependencies. Introduce rollbackTransaction(tx, context) and replace direct tx.Rollback() calls (including panic recovery) across handlers to centralize rollback logging/handling. Replace direct json.Unmarshal/Scan calls in tests with mustUnmarshalResponse/mustScan helpers. Add TrustedProxies to ServerConfig and configure Gin with SetTrustedProxies. Misc: adjust final Docker image (Alpine version and healthcheck command) and minor logging/formatting cleanups.
2026-04-16 03:38:12 +05:30
hhftechnologies
9d0b772458 Improve error handling, tests, and defaults
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Tests / Run Tests (push) Waiting to run
Tests / Lint (push) Waiting to run
Tests / Build (push) Blocked by required conditions
Add robust error checks and helpers, improve transaction safety, and refine default templates handling.

- Add api/handlers/test_helpers_test.go with mustUnmarshalResponse and mustScan helpers and update many handler tests to use them or to check json.Unmarshal errors to fail fast.
- Replace direct DB Scan calls in tests with mustScan or explicit error checks to surface query failures.
- Improve transaction rollback handling across codepaths (config handlers, database migrations, transaction utils, CertGenerator) to log rollback errors and avoid silent failures.
- Make WithTransaction/WithTimeoutTransaction/BatchTransaction formatting consistent and add panic-safe rollback logging.
- In main, log a warning instead of ignoring EnsureDefaultDataSources errors.
- Add/cleanup various helper blank assignments and small refactors in services (config_proxy, config_generator) and switch tests to shared response writers (writeJSONResponse/writeResponseBody) where applicable.
- Large cleanup and enhancements in config/defaults.go to preserve string formatting for YAML templates, ensure special fields are quoted/preserved, and tidy whitespace/formatting.

These changes improve test reliability, make DB/tx failures more visible, and ensure default template YAML preserves important string values.
2026-04-15 20:00:48 +05:30
hhftechnologies
1ebe62fca7 Support Traefik-only source; refactor fetchers/tests
Add support for a Traefik-only active data source by implementing buildStandaloneTraefikConfig and branching GetMergedConfig to avoid Pangolin network calls when active source is TraefikAPI. Refactor TraefikFetcher: centralize full-data loading, singleflight usage, caching, rate-limit helpers, fallback URL logic, and resource construction. Fix ServiceWatcher row handling by deferring rows.Close and checking rows.Err. Update many tests: un-skip and expand coverage for ConfigProxy (Traefik/Pangolin/unknown), TraefikFetcher (singleflight, endpoints, error cases), PluginFetcher, ResourceWatcher and ServiceWatcher; add test helpers (JSON writers, counting test server, model data source builder), adapt DB test inserts to new schema fields, and switch boolean flags to atomic as needed. Misc: tidy JSON handling and expected behaviors (e.g. plugin fetch returns empty on upstream error).
2026-04-15 19:32:47 +05:30
hhftechnologies
3593d6ec2c Fix: serversTransports from Pangolin config not passed through to Traefik
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Tests / Run Tests (push) Has been cancelled
Tests / Lint (push) Has been cancelled
Tests / Build (push) Has been cancelled
2026-03-22 11:41:16 +05:30
hhftechnologies
90a75b5a93 harden HTTP usage, caching, and transactional deletes
add safety across services: whitelist tables for DeleteInTransaction to prevent dynamic-SQL deletion abuse; remove a deprecated UpdateInTransaction helper. centralize HTTP client creation (HTTPClientWithTimeout/GetHTTPClient) and replace ad-hoc http.Clients with it; limit response body reads with io.LimitReader to avoid unbounded memory use; add better error logging when JSON marshal fails. Improve ConfigProxy cache handling to fetch outside locks, return stale cache on fetch errors, and only lock to swap the cache; add locking to SetCacheDuration and cap error body reads. convert ResourceWatcher isRunning to atomic.Bool for safe concurrent start/stop. Replace sync.Map memoization in id_normalizer with a bounded map protected by RWMutex (maxCacheSize), add cache flush behavior and tests/benchmarks to validate boundedness and hits. Miscellaneous test updates to match new behavior.
2026-03-01 14:22:02 +05:30
hhftechnologies
44a80ab152 add legacy_p12 option for PKCS#12 generation
add a legacy_p12 boolean to CreateClientRequest (backend model and frontend type) to support generating PKCS#12 files with legacy encryption for iOS/older device compatibility. CertGenerator now selects pkcs12.Legacy when legacy_p12 is true (defaults to Modern otherwise). UI: add a checkbox to the client cert creation dialog and initialize form state to include legacy_p12.
2026-03-01 13:23:10 +05:30
hhftechnologies
96b062dd94 Use middleware names for Traefik config
Key middleware entries in generated and proxied Traefik configs by middleware name (so chain references by name work) instead of by ID. Join middleware names in resource queries and scan them (with fallback to ID when name is not available), add Name fields to middleware structs, and use the extracted base name when building final middleware references. Also update log messages to include both name and ID. In the UI, enforce and auto-sanitize middleware names to lowercase a-z0-9- and hyphens only.
2026-02-17 16:37:02 +05:30
hhftechnologies
516a06a393 Add tests and atomicize service watcher flag
Add extensive unit tests across the codebase (api/errors, cache, many models tests, util/id_normalizer and others) to improve coverage and validate behavior. Replace ServiceWatcher.isRunning bool with atomic.Bool for safer concurrent access, update Start/Stop logic and related imports, and adjust service_watcher_test accordingly. Also update traefik_fetcher_test to use atomic counters for request counting and add minor import changes (sync/atomic).
2026-02-17 16:03:23 +05:30
hhftechnologies
fca08e470b Add support for external (Traefik) middlewares
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Tests / Run Tests (push) Waiting to run
Tests / Lint (push) Waiting to run
Tests / Build (push) Blocked by required conditions
Introduce support for Traefik-native external middlewares referenced by resources.

- Database: add resource_external_middlewares table in migrations and ensure creation in post-migration updates.
- API: add handlers and routes to assign, remove and list external middlewares; include external_middlewares field in GetResources/GetResource responses (comma-separated name:priority:provider entries). Handlers validate resource status, use transactions, and log errors.
- Services: ConfigProxy now loads external middleware refs, merges them with internal middlewares sorted by priority when building resource config.
- UI: Resource detail component, API client, store and types updated to expose listing, assigning and removing external middlewares with UI controls and confirmation modal.
- Tests: add unit tests for assign/remove/list handlers and inclusion on GetResource.

This enables referencing middlewares defined outside MW-manager (e.g., Traefik dynamic config or plugins) and honors priority/provider metadata.
2026-02-12 18:24:05 +05:30
hhftechnologies
a66930b676 Refactor test setup and skip outdated or pending tests
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Tests / Run Tests (push) Has been cancelled
Tests / Lint (push) Has been cancelled
Tests / Build (push) Has been cancelled
Refactored test files to use more idiomatic struct initialization and helper functions, reducing boilerplate and improving clarity. Added t.Skip calls to tests that are outdated or pending updates, and updated assertions in traefik_fetcher_test.go to use new method names. These changes improve maintainability and prepare the codebase for upcoming changes in fetcher and watcher behaviors.
2026-01-24 12:55:21 +05:30
hhftechnologies
ce71c4037c testfiles
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
Tests / Run Tests (push) Waiting to run
Tests / Lint (push) Waiting to run
Tests / Build (push) Blocked by required conditions
2026-01-24 11:58:12 +05:30
hhftechnologies
35c1218613 testfiles-update 2026-01-24 02:47:17 +05:30
hhftechnologies
e12b0974fe Update resource_watcher.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-23 19:15:59 +05:30
hhftechnologies
b64a974a63 Update pangolin_fetcher.go 2026-01-23 18:22:07 +05:30
hhftechnologies
f655a310b2 bugfixes-router 2026-01-23 17:14:12 +05:30
hhftechnologies
e026c53ecd Update pangolin_fetcher.go 2026-01-23 16:54:12 +05:30
hhftechnologies
84101c4018 service-mismatch 2026-01-23 13:37:23 +05:30
hhftechnologies
e578ec6a81 bugfixes-clearing-router-and-merge 2026-01-23 12:46:21 +05:30
hhftechnologies
54c741b56a service-bug-ui
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-23 11:52:06 +05:30
hhftechnologies
5661cb9214 Update resource_watcher.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-22 16:26:06 +05:30
hhftechnologies
f3405a2f0b update-router-resources-UUID 2026-01-22 15:34:22 +05:30
hhftechnologies
ca0731389b router-priority-fix 2026-01-22 14:48:36 +05:30
hhftechnologies
8203c39cbc Update config_proxy.go 2026-01-22 13:28:39 +05:30
hhftechnologies
d194ccd2da remove-IPWhiteList-deprecated 2026-01-21 19:27:23 +05:30
hhftechnologies
dfa2118dbb secure-headers-implementation 2026-01-21 11:39:45 +05:30
hhftechnologies
8d82c3d5f6 Update config_proxy.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-21 06:28:22 +05:30
hhftechnologies
f88df5c53d Update config_proxy.go 2026-01-21 06:13:17 +05:30
hhftechnologies
504611faba Update config_proxy.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-17 17:07:27 +05:30
hhftechnologies
2550a57207 Update config_proxy.go 2026-01-17 15:12:06 +05:30
hhftechnologies
4c76756593 updated-test-files-mtlsbugsfix 2026-01-17 13:12:44 +05:30
hhftechnologies
323d77661b mtls-whitelist 2026-01-17 12:17:09 +05:30
hhftechnologies
7a15d2dbf7 router-default-priority-100 2026-01-17 11:00:07 +05:30
hhftechnologies
b217e24fe4 mtls-error 2026-01-17 10:44:03 +05:30
hhftechnologies
1a993bdfa7 mtlsbugfixes
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-16 23:43:59 +05:30
hhftechnologies
a44a3db656 update-ENABLE_FILE_CONFIG=true-default-false 2026-01-16 19:57:15 +05:30
hhftechnologies
8de66b4e68 Update config_proxy.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-16 14:42:43 +05:30
hhftechnologies
7cb68c0c39 update-api 2026-01-16 13:09:59 +05:30
hhftechnologies
aa66d51e2e refactor-api
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-15 15:52:40 +05:30
hhftechnologies
84177fae20 Update config_manager.go
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-15 00:54:57 +05:30
hhftechnologies
7ad07565d7 bugfixes-ui-update
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-14 17:11:32 +05:30
hhftechnologies
0e9e516439 mtls-update
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-14 04:19:52 +05:30
hhftechnologies
e262a3e21e bugfixes
Some checks are pending
Build and Push Docker Image / build-and-push (push) Waiting to run
2026-01-13 03:20:41 +05:30
hhftechnologies
ec83c4e9a2 UI-Bugfixes 2026-01-12 01:12:13 +05:30
hhftechnologies
59282721dd refactoring 2026-01-11 15:24:17 +05:30
hhftechnologies
da8cc8f65c Update traefik_fetcher.go 2026-01-10 10:08:58 +05:30
hhftechnologies
56d33a7560 update-ui 2025-12-31 21:53:32 +05:30