Skip to main content

Egress

FTL requires verbs to declare any outbound egress they wish to do. At present no enforcement is done, however eventually FTL will use this to provision appropriate Istio policies when running on kube.

Examples

Examples of defining egress targets in different languages:

package example

import (
"context"

"github.com/block/ftl/go-runtime/ftl"
)
//ftl:verb export
//ftl:egress url="https://example.com"
func Fixed(ctx context.Context, url ftl.EgressTarget) (string, error) {
targetUrl := url.GetString(ctx) // Equal https://example.com
// Do HTTP requests with targetUrl
}

// For now in go you must explicitly declare config items used in egress urls
type Url = flt.Config[string]

//ftl:verb export
//ftl:egress url="${url}"
func FromConfig(ctx context.Context, url ftl.EgressTarget) (string, error) {
// This automatically creates a config item called url in the schema
targetUrl := url.GetString(ctx) // Equal to the value of the URL config item
// Do HTTP requests with targetUrl
}