mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-28 11:40:04 +00:00
Fix linting problems
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"npm/internal/logger"
|
||||
)
|
||||
|
||||
// SetAuth ...
|
||||
// SetAuth sets a auth method
|
||||
// Route: POST /users/:userID/auth
|
||||
func SetAuth() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -72,7 +72,7 @@ func CreateCertificateAuthority() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateCertificateAuthority ...
|
||||
// UpdateCertificateAuthority updates a ca
|
||||
// Route: PUT /certificate-authorities/{caID}
|
||||
func UpdateCertificateAuthority() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -105,7 +105,7 @@ func UpdateCertificateAuthority() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteCertificateAuthority ...
|
||||
// DeleteCertificateAuthority deletes a ca
|
||||
// Route: DELETE /certificate-authorities/{caID}
|
||||
func DeleteCertificateAuthority() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -77,7 +77,7 @@ func CreateCertificate() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateCertificate ...
|
||||
// UpdateCertificate updates a cert
|
||||
// Route: PUT /certificates/{certificateID}
|
||||
func UpdateCertificate() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -124,7 +124,7 @@ func UpdateCertificate() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteCertificate ...
|
||||
// DeleteCertificate deletes a cert
|
||||
// Route: DELETE /certificates/{certificateID}
|
||||
func DeleteCertificate() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -76,7 +76,7 @@ func CreateDNSProvider() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateDNSProvider ...
|
||||
// UpdateDNSProvider updates a provider
|
||||
// Route: PUT /dns-providers/{providerID}
|
||||
func UpdateDNSProvider() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -108,7 +108,7 @@ func UpdateDNSProvider() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteDNSProvider ...
|
||||
// DeleteDNSProvider removes a provider
|
||||
// Route: DELETE /dns-providers/{providerID}
|
||||
func DeleteDNSProvider() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -82,7 +82,7 @@ func CreateHost() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateHost ...
|
||||
// UpdateHost updates a host
|
||||
// Route: PUT /hosts/{hostID}
|
||||
func UpdateHost() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -114,7 +114,7 @@ func UpdateHost() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteHost ...
|
||||
// DeleteHost removes a host
|
||||
// Route: DELETE /hosts/{hostID}
|
||||
func DeleteHost() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -69,7 +69,7 @@ func CreateSetting() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateSetting ...
|
||||
// UpdateSetting updates a setting
|
||||
// Route: PUT /settings/{name}
|
||||
func UpdateSetting() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -76,7 +76,7 @@ func CreateStream() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateStream ...
|
||||
// UpdateStream updates a stream
|
||||
// Route: PUT /hosts/streams/{hostID}
|
||||
func UpdateStream() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -108,7 +108,7 @@ func UpdateStream() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteStream ...
|
||||
// DeleteStream removes a stream
|
||||
// Route: DELETE /hosts/streams/{hostID}
|
||||
func DeleteStream() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/go-chi/chi"
|
||||
)
|
||||
|
||||
// GetUsers ...
|
||||
// GetUsers returns all users
|
||||
// Route: GET /users
|
||||
func GetUsers() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -35,7 +35,7 @@ func GetUsers() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetUser ...
|
||||
// GetUser returns a specific user
|
||||
// Route: GET /users/{userID}
|
||||
func GetUser() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -55,7 +55,7 @@ func GetUser() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateUser ...
|
||||
// UpdateUser updates a user
|
||||
// Route: PUT /users/{userID}
|
||||
func UpdateUser() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -96,7 +96,7 @@ func UpdateUser() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteUser ...
|
||||
// DeleteUser removes a user
|
||||
// Route: DELETE /users/{userID}
|
||||
func DeleteUser() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -122,7 +122,7 @@ func DeleteUser() func(http.ResponseWriter, *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// CreateUser ...
|
||||
// CreateUser creates a user
|
||||
// Route: POST /users
|
||||
func CreateUser() func(http.ResponseWriter, *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -9,9 +9,9 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrInvalidJSON ...
|
||||
// ErrInvalidJSON is an error for invalid json
|
||||
ErrInvalidJSON = errors.New("JSON is invalid")
|
||||
// ErrInvalidPayload ...
|
||||
// ErrInvalidPayload is an error for invalid incoming data
|
||||
ErrInvalidPayload = errors.New("Payload is invalid")
|
||||
)
|
||||
|
||||
|
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/go-chi/jwtauth"
|
||||
)
|
||||
|
||||
// DecodeAuth ...
|
||||
// DecodeAuth decodes an auth header
|
||||
func DecodeAuth() func(http.Handler) http.Handler {
|
||||
privateKey, privateKeyParseErr := njwt.GetPrivateKey()
|
||||
if privateKeyParseErr != nil && privateKey == nil {
|
||||
|
@@ -46,7 +46,7 @@ var headersAllowedByCORS = []string{
|
||||
"X-Jumbo-Customer-Id",
|
||||
}
|
||||
|
||||
// Cors ...
|
||||
// Cors handles cors headers
|
||||
func Cors(routes chi.Router) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -66,7 +66,7 @@ func Cors(routes chi.Router) func(http.Handler) http.Handler {
|
||||
}
|
||||
}
|
||||
|
||||
// Options ...
|
||||
// Options handles options requests
|
||||
func Options(routes chi.Router) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/qri-io/jsonschema"
|
||||
)
|
||||
|
||||
// CheckRequestSchema ...
|
||||
// CheckRequestSchema checks the payload against schema
|
||||
func CheckRequestSchema(ctx context.Context, schemaData string, payload []byte) ([]jsonschema.KeyError, error) {
|
||||
// Create root schema
|
||||
rs := &jsonschema.Schema{}
|
||||
|
@@ -14,10 +14,10 @@ var IsSetup bool
|
||||
// ErrorReporting defines whether we will send errors to Sentry
|
||||
var ErrorReporting bool
|
||||
|
||||
// PublicKey ...
|
||||
// PublicKey is the public key
|
||||
var PublicKey string
|
||||
|
||||
// PrivateKey ...
|
||||
// PrivateKey is the private key
|
||||
var PrivateKey string
|
||||
|
||||
var logLevel logger.Level
|
||||
@@ -27,7 +27,7 @@ type log struct {
|
||||
Format string `json:"format" envconfig:"optional,default=nice"`
|
||||
}
|
||||
|
||||
// Configuration ...
|
||||
// Configuration is the main configuration object
|
||||
var Configuration struct {
|
||||
DataFolder string `json:"data_folder" envconfig:"optional,default=/data"`
|
||||
Log log `json:"log"`
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -13,14 +13,15 @@ import (
|
||||
const (
|
||||
tableName = "certificate"
|
||||
|
||||
// TypeCustom ...
|
||||
// TypeCustom custom cert type
|
||||
TypeCustom = "custom"
|
||||
// TypeHTTP ...
|
||||
// TypeHTTP http cert type
|
||||
TypeHTTP = "http"
|
||||
// TypeDNS ...
|
||||
// TypeDNS dns cert type
|
||||
TypeDNS = "dns"
|
||||
// TypeMkcert ...
|
||||
// TypeMkcert mkcert cert type
|
||||
TypeMkcert = "mkcert"
|
||||
|
||||
// StatusReady is ready for certificate to be requested
|
||||
StatusReady = "ready"
|
||||
// StatusRequesting is process of being requested
|
||||
@@ -151,7 +152,7 @@ func (m *Model) Expand() {
|
||||
}
|
||||
}
|
||||
|
||||
// Request ...
|
||||
// Request makes a certificate request
|
||||
func (m *Model) Request() error {
|
||||
m.Expand()
|
||||
m.Status = StatusRequesting
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -11,10 +11,10 @@ import (
|
||||
// FilterMapFunction is a filter map function
|
||||
type FilterMapFunction func(value []string) []string
|
||||
|
||||
// FilterTagName ...
|
||||
// FilterTagName tag name user for filter pickups
|
||||
const FilterTagName = "filter"
|
||||
|
||||
// DBTagName ...
|
||||
// DBTagName tag name user for field name pickups
|
||||
const DBTagName = "db"
|
||||
|
||||
// GenerateSQLFromFilters will return a Query and params for use as WHERE clause in SQL queries
|
||||
@@ -96,7 +96,7 @@ func getSQLAssignmentFromModifier(filter model.Filter, params *[]interface{}) st
|
||||
return clause
|
||||
}
|
||||
|
||||
// GetFilterMap ...
|
||||
// GetFilterMap returns the filter map
|
||||
func GetFilterMap(m interface{}) map[string]string {
|
||||
var filterMap = make(map[string]string)
|
||||
|
||||
@@ -125,7 +125,7 @@ func GetFilterMap(m interface{}) map[string]string {
|
||||
return filterMap
|
||||
}
|
||||
|
||||
// GetDBColumns ...
|
||||
// GetDBColumns returns the db columns
|
||||
func GetDBColumns(m interface{}) []string {
|
||||
var columns []string
|
||||
t := reflect.TypeOf(m)
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -11,11 +11,11 @@ import (
|
||||
const (
|
||||
tableName = "host"
|
||||
|
||||
// ProxyHostType ...
|
||||
// ProxyHostType is self explanatory
|
||||
ProxyHostType = "proxy"
|
||||
// RedirectionHostType ...
|
||||
// RedirectionHostType is self explanatory
|
||||
RedirectionHostType = "redirection"
|
||||
// DeadHostType ...
|
||||
// DeadHostType is self explanatory
|
||||
DeadHostType = "dead"
|
||||
)
|
||||
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -18,7 +18,7 @@ func getFilterMapFunctions() map[string]entity.FilterMapFunction {
|
||||
return filterMapFunctions
|
||||
}
|
||||
|
||||
// GetFilterSchema ...
|
||||
// GetFilterSchema returns filter schema
|
||||
func GetFilterSchema() string {
|
||||
var m Model
|
||||
return entity.GetFilterSchema(m)
|
||||
|
@@ -15,7 +15,7 @@ type PageInfo struct {
|
||||
Expand []string `json:"expand"`
|
||||
}
|
||||
|
||||
// Sort ...
|
||||
// Sort holds the sorting data
|
||||
type Sort struct {
|
||||
Field string `json:"field"`
|
||||
Direction string `json:"direction"`
|
||||
|
@@ -11,7 +11,7 @@ type AppState struct {
|
||||
termSig chan bool
|
||||
}
|
||||
|
||||
// NewState ...
|
||||
// NewState creates a new app state
|
||||
func NewState() *AppState {
|
||||
state := &AppState{
|
||||
// buffered channel
|
||||
@@ -20,12 +20,12 @@ func NewState() *AppState {
|
||||
return state
|
||||
}
|
||||
|
||||
// GetWaitGroup ...
|
||||
// GetWaitGroup returns the state's wg
|
||||
func (state *AppState) GetWaitGroup() *sync.WaitGroup {
|
||||
return &state.waitGroup
|
||||
}
|
||||
|
||||
// GetTermSig ...
|
||||
// GetTermSig returns the state's term signal
|
||||
func (state *AppState) GetTermSig() chan bool {
|
||||
return state.termSig
|
||||
}
|
||||
|
Reference in New Issue
Block a user