Skip to content

Commit b5d90e4

Browse files
committed
feature: Documented all functions
1 parent 24a7f30 commit b5d90e4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+156
-24
lines changed

app/handlers/command.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/limanmys/render-engine/pkg/logger"
99
)
1010

11+
// CommandRunner runs command on specified server
1112
func CommandRunner(c *fiber.Ctx) error {
1213
if len(c.FormValue("server_id")) < 1 {
1314
return logger.FiberError(fiber.StatusBadRequest, "server not found")
@@ -35,6 +36,7 @@ func CommandRunner(c *fiber.Ctx) error {
3536
return c.SendString(output)
3637
}
3738

39+
// OutsideCommandRunner runs command on external endpoints
3840
func OutsideCommandRunner(c *fiber.Ctx) error {
3941
params := []string{
4042
"command",

app/handlers/db.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/limanmys/render-engine/pkg/logger"
88
)
99

10+
// SetExtensionDb changes specified vault keys from extension
1011
func SetExtensionDb(c *fiber.Ctx) error {
1112
params := []string{"target", "new_param", "server_id", "extension_id", "token"}
1213

app/handlers/extension.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"go.uber.org/zap"
1414
)
1515

16+
// ExtensionRunner runs extensions and returns rendered HTML/JSON views
1617
func ExtensionRunner(c *fiber.Ctx) error {
1718
if len(c.FormValue("extension_id")) < 1 {
1819
return logger.FiberError(fiber.StatusBadRequest, "extension not found")

app/handlers/external.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/limanmys/render-engine/pkg/logger"
1313
)
1414

15+
// ExternalAPI used for running other extension functions from a different extension
1516
func ExternalAPI(c *fiber.Ctx) error {
1617
var extension *models.Extension
1718
var err error

app/handlers/file.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/limanmys/render-engine/pkg/logger"
1414
)
1515

16+
// PutFile puts file to remote end from local path
1617
func PutFile(c *fiber.Ctx) error {
1718
params := []string{"server_id", "remote_path", "local_path"}
1819

@@ -63,6 +64,7 @@ func PutFile(c *fiber.Ctx) error {
6364
}`)
6465
}
6566

67+
// GetFile downloads file from remote path to local path
6668
func GetFile(c *fiber.Ctx) error {
6769
params := []string{"server_id", "remote_path", "local_path"}
6870

@@ -113,6 +115,7 @@ func GetFile(c *fiber.Ctx) error {
113115
}`)
114116
}
115117

118+
// DownloadFile returns file pointer
116119
func DownloadFile(c *fiber.Ctx) error {
117120
params := []string{"server_id", "path", "extension_id"}
118121

app/handlers/job.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/limanmys/render-engine/pkg/logger"
1111
)
1212

13+
// BackgroundJob creates a background shell command
1314
func BackgroundJob(c *fiber.Ctx) error {
1415
if len(c.FormValue("extension_id")) < 1 {
1516
return logger.FiberError(fiber.StatusBadRequest, "extension not found")

app/handlers/script.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/limanmys/render-engine/pkg/logger"
1111
)
1212

13+
// ScriptRunner runs scripts on remote server
1314
func ScriptRunner(c *fiber.Ctx) error {
1415
params := []string{"local_path", "root", "parameters", "server_id"}
1516

app/handlers/tunnel.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/limanmys/render-engine/pkg/logger"
77
)
88

9+
// OpenTunnel opens ssh tunnel on unix sockets or ports
910
func OpenTunnel(c *fiber.Ctx) error {
1011
params := []string{"remote_host", "remote_port", "username", "password"}
1112

@@ -31,6 +32,7 @@ func OpenTunnel(c *fiber.Ctx) error {
3132
return c.JSON(port)
3233
}
3334

35+
// KeepTunnelAlive keeps tunnel connection alive
3436
func KeepTunnelAlive(c *fiber.Ctx) error {
3537
params := []string{"remote_host", "remote_port", "username"}
3638

app/handlers/verify.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/limanmys/render-engine/pkg/logger"
77
)
88

9+
// Verify verifies credentials
910
func Verify(c *fiber.Ctx) error {
1011
params := []string{"ip_address", "username", "password", "port", "key_type"}
1112

app/middleware/app_logger/new.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"go.uber.org/zap"
1111
)
1212

13+
// Creates a new app logger instance
14+
// This logger logs requests and removes safe information like password etc.
1315
func New() fiber.Handler {
1416
return func(c *fiber.Ctx) (err error) {
1517
c.Locals("log_id", uuid.NewString())

0 commit comments

Comments
 (0)