🚨 Removed some linter warnings
This commit is contained in:
parent
1ff04b42bd
commit
8f85c4c681
|
@ -2,10 +2,14 @@
|
||||||
run:
|
run:
|
||||||
tests: true
|
tests: true
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
|
- builtin
|
||||||
|
- examples
|
||||||
|
- Godeps
|
||||||
- locales
|
- locales
|
||||||
- testdata
|
- testdata
|
||||||
|
- third_party
|
||||||
|
- vendor
|
||||||
- web
|
- web
|
||||||
skip-dirs-use-default: true
|
|
||||||
skip-files:
|
skip-files:
|
||||||
- ".*_gen\\.go$"
|
- ".*_gen\\.go$"
|
||||||
output:
|
output:
|
||||||
|
@ -33,6 +37,7 @@ linters-settings:
|
||||||
ignore-map-index-ok: true
|
ignore-map-index-ok: true
|
||||||
ignore-chan-recv-ok: true
|
ignore-chan-recv-ok: true
|
||||||
ignore-names:
|
ignore-names:
|
||||||
|
- cid # ClientID
|
||||||
- ctx # context
|
- ctx # context
|
||||||
- db # dataBase
|
- db # dataBase
|
||||||
- err # error
|
- err # error
|
||||||
|
@ -43,16 +48,17 @@ linters-settings:
|
||||||
- ln # listener
|
- ln # listener
|
||||||
- me
|
- me
|
||||||
- ok
|
- ok
|
||||||
|
- r # Request
|
||||||
- tc # testCase
|
- tc # testCase
|
||||||
- ts # timeStamp
|
- ts # timeStamp
|
||||||
- tx # transaction
|
- tx # transaction
|
||||||
|
- w # ResponseWriter
|
||||||
ignore-decls:
|
ignore-decls:
|
||||||
- "cid *domain.ClientID"
|
|
||||||
- "ctx *fasthttp.RequestCtx"
|
|
||||||
- "ctx context.Context"
|
- "ctx context.Context"
|
||||||
|
- "err error"
|
||||||
- "i int"
|
- "i int"
|
||||||
- "me *domain.Me"
|
- "r *http.Request"
|
||||||
- "r *router.Router"
|
- "w http.ResponseWriter"
|
||||||
linters:
|
linters:
|
||||||
enable-all: true
|
enable-all: true
|
||||||
disable:
|
disable:
|
||||||
|
|
28
main.go
28
main.go
|
@ -7,7 +7,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
_ "embed"
|
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
|
@ -96,9 +95,11 @@ var (
|
||||||
// NOTE(toby3d): read configuration from environment, see: https://12factor.net/config
|
// NOTE(toby3d): read configuration from environment, see: https://12factor.net/config
|
||||||
config = new(domain.Config)
|
config = new(domain.Config)
|
||||||
indieAuthClient = &domain.Client{
|
indieAuthClient = &domain.Client{
|
||||||
URL: make([]*url.URL, 1),
|
ID: domain.ClientID{},
|
||||||
Logo: make([]*url.URL, 1),
|
Logo: make([]*url.URL, 1),
|
||||||
RedirectURI: make([]*url.URL, 1),
|
RedirectURI: make([]*url.URL, 1),
|
||||||
|
URL: make([]*url.URL, 1),
|
||||||
|
Name: make([]string, 0),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -115,7 +116,11 @@ func init() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if err := env.Parse(&config, env.Options{
|
if err := env.Parse(&config, env.Options{
|
||||||
|
Environment: nil,
|
||||||
|
OnSet: nil,
|
||||||
Prefix: "INDIEAUTH_",
|
Prefix: "INDIEAUTH_",
|
||||||
|
RequiredIfNoDef: false,
|
||||||
|
TagName: "",
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
logger.Fatalln(err)
|
logger.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
@ -185,11 +190,19 @@ func main() {
|
||||||
|
|
||||||
app := NewApp(opts)
|
app := NewApp(opts)
|
||||||
|
|
||||||
//nolint:exhaustivestruct
|
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Addr: config.Server.GetAddress(),
|
Addr: config.Server.GetAddress(),
|
||||||
|
BaseContext: nil,
|
||||||
|
ConnContext: nil,
|
||||||
|
ConnState: nil,
|
||||||
|
ErrorLog: logger,
|
||||||
Handler: app.Handler(),
|
Handler: app.Handler(),
|
||||||
|
IdleTimeout: 0,
|
||||||
|
MaxHeaderBytes: 0,
|
||||||
|
ReadHeaderTimeout: 0,
|
||||||
ReadTimeout: DefaultReadTimeout,
|
ReadTimeout: DefaultReadTimeout,
|
||||||
|
TLSConfig: nil,
|
||||||
|
TLSNextProto: nil,
|
||||||
WriteTimeout: DefaultWriteTimeout,
|
WriteTimeout: DefaultWriteTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +274,10 @@ func NewApp(opts NewAppOptions) *App {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(toby3d): move module middlewares to here.
|
// TODO(toby3d): move module middlewares to here.
|
||||||
|
//
|
||||||
|
//nolint:funlen
|
||||||
func (app *App) Handler() http.Handler {
|
func (app *App) Handler() http.Handler {
|
||||||
|
//nolint:exhaustivestruct
|
||||||
metadata := metadatahttpdelivery.NewHandler(&domain.Metadata{
|
metadata := metadatahttpdelivery.NewHandler(&domain.Metadata{
|
||||||
Issuer: indieAuthClient.ID.URL(),
|
Issuer: indieAuthClient.ID.URL(),
|
||||||
AuthorizationEndpoint: indieAuthClient.ID.URL().JoinPath("authorize"),
|
AuthorizationEndpoint: indieAuthClient.ID.URL().JoinPath("authorize"),
|
||||||
|
@ -272,7 +288,11 @@ func (app *App) Handler() http.Handler {
|
||||||
IntrospectionEndpoint: indieAuthClient.ID.URL().JoinPath("introspect"),
|
IntrospectionEndpoint: indieAuthClient.ID.URL().JoinPath("introspect"),
|
||||||
RevocationEndpoint: indieAuthClient.ID.URL().JoinPath("revocation"),
|
RevocationEndpoint: indieAuthClient.ID.URL().JoinPath("revocation"),
|
||||||
UserinfoEndpoint: indieAuthClient.ID.URL().JoinPath("userinfo"),
|
UserinfoEndpoint: indieAuthClient.ID.URL().JoinPath("userinfo"),
|
||||||
ServiceDocumentation: &url.URL{Scheme: "https", Host: "indieauth.net", Path: "/source/"},
|
ServiceDocumentation: &url.URL{
|
||||||
|
Scheme: "https",
|
||||||
|
Host: "indieauth.net",
|
||||||
|
Path: "/source/",
|
||||||
|
},
|
||||||
IntrospectionEndpointAuthMethodsSupported: []string{"Bearer"},
|
IntrospectionEndpointAuthMethodsSupported: []string{"Bearer"},
|
||||||
RevocationEndpointAuthMethodsSupported: []string{"none"},
|
RevocationEndpointAuthMethodsSupported: []string{"none"},
|
||||||
ScopesSupported: domain.Scopes{
|
ScopesSupported: domain.Scopes{
|
||||||
|
|
Loading…
Reference in New Issue