Add godot linter to harmonitze toplevel comments (#3650)

This commit is contained in:
Robert Kaussow
2024-05-13 22:58:21 +02:00
committed by GitHub
parent 83eba294c7
commit 89e100cfd1
144 changed files with 302 additions and 302 deletions

View File

@@ -22,13 +22,13 @@ import (
"github.com/golang-jwt/jwt/v5"
)
// JWTManager is a JSON web token manager
// JWTManager is a JSON web token manager.
type JWTManager struct {
secretKey string
tokenDuration time.Duration
}
// UserClaims is a custom JWT claims that contains some user's information
// UserClaims is a custom JWT claims that contains some user's information.
type AgentTokenClaims struct {
jwt.RegisteredClaims
AgentID int64 `json:"agent_id"`
@@ -36,12 +36,12 @@ type AgentTokenClaims struct {
const jwtTokenDuration = 1 * time.Hour
// NewJWTManager returns a new JWT manager
// NewJWTManager returns a new JWT manager.
func NewJWTManager(secretKey string) *JWTManager {
return &JWTManager{secretKey, jwtTokenDuration}
}
// Generate generates and signs a new token for a user
// Generate generates and signs a new token for a user.
func (manager *JWTManager) Generate(agentID int64) (string, error) {
claims := AgentTokenClaims{
RegisteredClaims: jwt.RegisteredClaims{
@@ -60,7 +60,7 @@ func (manager *JWTManager) Generate(agentID int64) (string, error) {
return token.SignedString([]byte(manager.secretKey))
}
// Verify verifies the access token string and return a user claim if the token is valid
// Verify verifies the access token string and return a user claim if the token is valid.
func (manager *JWTManager) Verify(accessToken string) (*AgentTokenClaims, error) {
token, err := jwt.ParseWithClaims(
accessToken,

View File

@@ -13,8 +13,6 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This file has been modified by Informatyka Boguslawski sp. z o.o. sp.k.
package grpc
@@ -50,7 +48,7 @@ type RPC struct {
pipelineCount *prometheus.CounterVec
}
// Next implements the rpc.Next function
// Next implements the rpc.Next function.
func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, error) {
if hostname, err := s.getHostnameFromContext(c); err == nil {
log.Debug().Msgf("agent connected: %s: polling", hostname)
@@ -88,17 +86,17 @@ func (s *RPC) Next(c context.Context, agentFilter rpc.Filter) (*rpc.Workflow, er
}
}
// Wait implements the rpc.Wait function
// Wait implements the rpc.Wait function.
func (s *RPC) Wait(c context.Context, id string) error {
return s.queue.Wait(c, id)
}
// Extend implements the rpc.Extend function
// Extend implements the rpc.Extend function.
func (s *RPC) Extend(c context.Context, id string) error {
return s.queue.Extend(c, id)
}
// Update implements the rpc.Update function
// Update implements the rpc.Update function.
func (s *RPC) Update(_ context.Context, id string, state rpc.State) error {
workflowID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -164,7 +162,7 @@ func (s *RPC) Update(_ context.Context, id string, state rpc.State) error {
return nil
}
// Init implements the rpc.Init function
// Init implements the rpc.Init function.
func (s *RPC) Init(c context.Context, id string, state rpc.State) error {
stepID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -230,7 +228,7 @@ func (s *RPC) Init(c context.Context, id string, state rpc.State) error {
return nil
}
// Done implements the rpc.Done function
// Done implements the rpc.Done function.
func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
workflowID, err := strconv.ParseInt(id, 10, 64)
if err != nil {
@@ -319,7 +317,7 @@ func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
return nil
}
// Log implements the rpc.Log function
// Log implements the rpc.Log function.
func (s *RPC) Log(c context.Context, _logEntry *rpc.LogEntry) error {
// convert rpc log_entry to model.log_entry
step, err := s.store.StepByUUID(_logEntry.StepUUID)