-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NET-404] Run in limited mode when ee checks fail (#2474)
* Add limited http handlers functionality to rest handler * Export ee.errValidation (ee.ErrValidation) * Export a fatal error handled by the hook manager * Export a new status variable for unlicensed server * Mark server as unlicensed when ee checks fail * Handle license validation failures with a (re)boot in a limited state * Revert "Export a fatal error handled by the hook manager" This reverts commit 069c219. * Revert "Export ee.errValidation (ee.ErrValidation)" This reverts commit 59dbab8. * Revert "Add limited http handlers functionality to rest handler" This reverts commit e2f1f28. * Revert "Handle license validation failures with a (re)boot in a limited state" This reverts commit 58cfbba. * Revert "Mark server as unlicensed when ee checks fail" This reverts commit 77c6dbd. * Handle license validation failures with a middleware * Forbid responses if unlicensed ee and not in status api * Remove unused func
- Loading branch information
1 parent
a021e26
commit 922e7db
Showing
7 changed files
with
90 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package ee_controllers | ||
|
||
import ( | ||
"github.com/gravitl/netmaker/logic" | ||
"github.com/gravitl/netmaker/servercfg" | ||
"net/http" | ||
) | ||
|
||
func OnlyServerAPIWhenUnlicensedMiddleware(handler http.Handler) http.Handler { | ||
return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { | ||
if servercfg.ErrLicenseValidation != nil && request.URL.Path != "/api/server/status" { | ||
logic.ReturnErrorResponse(writer, request, logic.FormatError(servercfg.ErrLicenseValidation, "forbidden")) | ||
return | ||
} | ||
handler.ServeHTTP(writer, request) | ||
}) | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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