-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Various QOL changes. #169
Merged
Various QOL changes. #169
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bb5225d
Various QOL changes.
q-uint c20c61c
Move filter package out of internal.
q-uint 3771793
Expose filter validator.
q-uint bbdc923
feat: create server instance using constructor, use interface-based l…
icamys 908b038
fix: update server construction code
icamys 03e7f40
fix: correct resource type auto renaming
icamys dea8381
fix: correct resource type auto renaming
icamys 8da6be6
docs: correct the example in the docs
icamys da9994d
feat: change server constructor to accept mandatory arguments
icamys bea28f3
Arrange code + tidy.
q-uint 314c7a6
Fix typo.
q-uint 9b972dd
Fix merge conflict.
q-uint 9455b77
Add note about backwards compatibility.
q-uint 826394c
Fix typo README.
q-uint File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.PHONY: all arrange tidy lint test | ||
|
||
all: arrange tidy lint test | ||
|
||
arrange: | ||
@echo "Arranging files..." | ||
@go fmt ./... | ||
@goarrange run -r | ||
|
||
tidy: | ||
@echo "Tidying up..." | ||
@go mod tidy | ||
|
||
lint: | ||
q-uint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@echo "Linting files..." | ||
@go vet ./... | ||
@golangci-lint run ./... -E misspell,godot,whitespace | ||
|
||
test: | ||
@echo "Running tests..." | ||
@go test ./... -cover |
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 |
---|---|---|
@@ -1,21 +1,53 @@ | ||
package scim | ||
|
||
import ( | ||
"log" | ||
logger "log" | ||
"net/http" | ||
) | ||
|
||
func ExampleNewServer() { | ||
log.Fatal(http.ListenAndServe(":7643", Server{ | ||
Config: ServiceProviderConfig{}, | ||
ResourceTypes: nil, | ||
})) | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
logger.Fatal(http.ListenAndServe(":7643", server)) | ||
} | ||
|
||
func ExampleNewServer_basePath() { | ||
http.Handle("/scim/", http.StripPrefix("/scim", Server{ | ||
Config: ServiceProviderConfig{}, | ||
ResourceTypes: nil, | ||
})) | ||
log.Fatal(http.ListenAndServe(":7643", nil)) | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
// You can host the SCIM server on a custom path, make sure to strip the prefix, so only `/v2/` is left. | ||
http.Handle("/scim/", http.StripPrefix("/scim", server)) | ||
logger.Fatal(http.ListenAndServe(":7643", nil)) | ||
} | ||
|
||
func ExampleNewServer_logger() { | ||
q-uint marked this conversation as resolved.
Show resolved
Hide resolved
|
||
loggingMiddleware := func(next http.Handler) http.Handler { | ||
fn := func(w http.ResponseWriter, r *http.Request) { | ||
logger.Println(r.Method, r.URL.Path) | ||
|
||
next.ServeHTTP(w, r) | ||
} | ||
|
||
return http.HandlerFunc(fn) | ||
} | ||
args := &ServerArgs{ | ||
ServiceProviderConfig: &ServiceProviderConfig{}, | ||
ResourceTypes: []ResourceType{}, | ||
} | ||
server, err := NewServer(args) | ||
if err != nil { | ||
logger.Fatal(err) | ||
} | ||
logger.Fatal(http.ListenAndServe(":7643", loggingMiddleware(server))) | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the Makefile has been added, wouldn't using it in the Github workflow make sense? There is some code duplication now in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some duplication, the big difference is that in the CI it checks whether it has been done, and in the Makefile it is actually executing the actions.