diff --git a/.gitignore b/.gitignore index cbb31f7d..fb1624ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -.idea +git.idea .env .DS_Store ._* @@ -17,4 +17,5 @@ frontend/.npmrc test/cypress/fixtures/example.json .vscode docker-build -data \ No newline at end of file +data +dist diff --git a/backend/internal/api/handler/auth.go b/backend/internal/api/handler/auth.go index 972022de..c4baa34c 100644 --- a/backend/internal/api/handler/auth.go +++ b/backend/internal/api/handler/auth.go @@ -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) { diff --git a/backend/internal/api/handler/certificate_authorities.go b/backend/internal/api/handler/certificate_authorities.go index e5c453ef..13d1e9aa 100644 --- a/backend/internal/api/handler/certificate_authorities.go +++ b/backend/internal/api/handler/certificate_authorities.go @@ -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) { diff --git a/backend/internal/api/handler/certificates.go b/backend/internal/api/handler/certificates.go index 8e70794b..8c48ddd1 100644 --- a/backend/internal/api/handler/certificates.go +++ b/backend/internal/api/handler/certificates.go @@ -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) { diff --git a/backend/internal/api/handler/dns_providers.go b/backend/internal/api/handler/dns_providers.go index 045619aa..cd1fb816 100644 --- a/backend/internal/api/handler/dns_providers.go +++ b/backend/internal/api/handler/dns_providers.go @@ -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) { diff --git a/backend/internal/api/handler/hosts.go b/backend/internal/api/handler/hosts.go index 58c75c98..53628e09 100644 --- a/backend/internal/api/handler/hosts.go +++ b/backend/internal/api/handler/hosts.go @@ -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) { diff --git a/backend/internal/api/handler/settings.go b/backend/internal/api/handler/settings.go index c73e7385..b0e1d7ac 100644 --- a/backend/internal/api/handler/settings.go +++ b/backend/internal/api/handler/settings.go @@ -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) { diff --git a/backend/internal/api/handler/streams.go b/backend/internal/api/handler/streams.go index 04b277b6..17c668e4 100644 --- a/backend/internal/api/handler/streams.go +++ b/backend/internal/api/handler/streams.go @@ -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) { diff --git a/backend/internal/api/handler/users.go b/backend/internal/api/handler/users.go index d2988966..2a714a22 100644 --- a/backend/internal/api/handler/users.go +++ b/backend/internal/api/handler/users.go @@ -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) { diff --git a/backend/internal/api/http/requests.go b/backend/internal/api/http/requests.go index c07d3fa6..3e7103c0 100644 --- a/backend/internal/api/http/requests.go +++ b/backend/internal/api/http/requests.go @@ -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") ) diff --git a/backend/internal/api/middleware/auth.go b/backend/internal/api/middleware/auth.go index 925c7992..4433b6cc 100644 --- a/backend/internal/api/middleware/auth.go +++ b/backend/internal/api/middleware/auth.go @@ -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 { diff --git a/backend/internal/api/middleware/cors.go b/backend/internal/api/middleware/cors.go index a3b2fbb9..f2de6d72 100644 --- a/backend/internal/api/middleware/cors.go +++ b/backend/internal/api/middleware/cors.go @@ -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) { diff --git a/backend/internal/api/middleware/schema.go b/backend/internal/api/middleware/schema.go index d3dba570..0da920e2 100644 --- a/backend/internal/api/middleware/schema.go +++ b/backend/internal/api/middleware/schema.go @@ -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{} diff --git a/backend/internal/config/vars.go b/backend/internal/config/vars.go index f856a940..cdd2cc43 100644 --- a/backend/internal/config/vars.go +++ b/backend/internal/config/vars.go @@ -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"` diff --git a/backend/internal/entity/certificate/filters.go b/backend/internal/entity/certificate/filters.go index 5e321af8..1c034c15 100644 --- a/backend/internal/entity/certificate/filters.go +++ b/backend/internal/entity/certificate/filters.go @@ -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) diff --git a/backend/internal/entity/certificate/model.go b/backend/internal/entity/certificate/model.go index dc0dec5f..c504664b 100644 --- a/backend/internal/entity/certificate/model.go +++ b/backend/internal/entity/certificate/model.go @@ -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 diff --git a/backend/internal/entity/certificateauthority/filters.go b/backend/internal/entity/certificateauthority/filters.go index 89d2d70f..a16ba01e 100644 --- a/backend/internal/entity/certificateauthority/filters.go +++ b/backend/internal/entity/certificateauthority/filters.go @@ -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) diff --git a/backend/internal/entity/dnsprovider/filters.go b/backend/internal/entity/dnsprovider/filters.go index 683e8ec6..30ab6c52 100644 --- a/backend/internal/entity/dnsprovider/filters.go +++ b/backend/internal/entity/dnsprovider/filters.go @@ -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) diff --git a/backend/internal/entity/filters.go b/backend/internal/entity/filters.go index 55c5464f..9709fa16 100644 --- a/backend/internal/entity/filters.go +++ b/backend/internal/entity/filters.go @@ -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) diff --git a/backend/internal/entity/host/filters.go b/backend/internal/entity/host/filters.go index 643a417d..7b023917 100644 --- a/backend/internal/entity/host/filters.go +++ b/backend/internal/entity/host/filters.go @@ -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) diff --git a/backend/internal/entity/host/model.go b/backend/internal/entity/host/model.go index 8d2f851d..955e758a 100644 --- a/backend/internal/entity/host/model.go +++ b/backend/internal/entity/host/model.go @@ -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" ) diff --git a/backend/internal/entity/setting/filters.go b/backend/internal/entity/setting/filters.go index 0c4d6371..c9e92416 100644 --- a/backend/internal/entity/setting/filters.go +++ b/backend/internal/entity/setting/filters.go @@ -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) diff --git a/backend/internal/entity/stream/filters.go b/backend/internal/entity/stream/filters.go index f0078894..bf4c8832 100644 --- a/backend/internal/entity/stream/filters.go +++ b/backend/internal/entity/stream/filters.go @@ -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) diff --git a/backend/internal/entity/user/filters.go b/backend/internal/entity/user/filters.go index ea1c1640..bc38ef69 100644 --- a/backend/internal/entity/user/filters.go +++ b/backend/internal/entity/user/filters.go @@ -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) diff --git a/backend/internal/model/pageinfo.go b/backend/internal/model/pageinfo.go index 129a0a14..3f1fd26f 100644 --- a/backend/internal/model/pageinfo.go +++ b/backend/internal/model/pageinfo.go @@ -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"` diff --git a/backend/internal/state/state.go b/backend/internal/state/state.go index e09867a8..0fa1433f 100644 --- a/backend/internal/state/state.go +++ b/backend/internal/state/state.go @@ -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 }