-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tunnels): centralize tunnel management and integrate with de…
…ployment process
- Loading branch information
Showing
4 changed files
with
68 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package deployment | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/yarlson/ftl/pkg/config" | ||
"github.com/yarlson/ftl/pkg/tunnel" | ||
) | ||
|
||
func hasLocalHooks(cfg *config.Config) bool { | ||
for _, service := range cfg.Services { | ||
if service.Hooks != nil && service.Hooks.Pre != nil && service.Hooks.Pre.Local != "" { | ||
return true | ||
} | ||
if service.Hooks != nil && service.Hooks.Post != nil && service.Hooks.Post.Local != "" { | ||
return true | ||
} | ||
} | ||
|
||
return false | ||
} | ||
|
||
func (d *Deployment) startTunnels(ctx context.Context, cfg *config.Config) error { | ||
err := tunnel.StartTunnels( | ||
ctx, | ||
cfg.Server.Host, cfg.Server.Port, | ||
cfg.Server.User, cfg.Server.SSHKey, | ||
tunnel.CollectDependencyTunnels(cfg), | ||
) | ||
if err != nil { | ||
return fmt.Errorf("failed to establish tunnels: %w", err) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters