fly

package module
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 0 Imported by: 0

README

Build Status Coverage Report Go Reference

fly

Package fly and its sub-packages implement helpers for Go apps running on fly.io.

Usage

package main

import (
	"context"
	"log"
	"strings"

	"github.com/azazeal/fly/dns"
	"github.com/azazeal/fly/env"
)

func main() {
	if !env.IsSet() {
		log.Fatal("not running on fly")
	}

	const format = `running on fly: %t
---
$FLY_APP_NAME: %s,
$FLY_ALLOC_ID: %s,
$FLY_PUBLIC_IP: %s,
$FLY_REGION: %s,
`
	log.Printf(format,
		env.IsSet(),
		env.AppName(),
		env.AllocID(),
		env.PublicIP(),
		env.Region(),
	)

	apps, err := dns.Apps(context.TODO())
	if err != nil {
		log.Fatalf("failed determining apps: %v", apps)
	}

	log.Printf("fly apps in our organization: %s", strings.Join(apps, ", "))
}

Documentation

Overview

Package fly and its sub-packages implement helpers for Go apps running on fly.io

Directories

Path Synopsis
Package dns implements functionality for when dealing with fly's internal DNS.
Package dns implements functionality for when dealing with fly's internal DNS.
Package env implements functionality for when dealing with fly's environment variables.
Package env implements functionality for when dealing with fly's environment variables.
internal
testutil
Package testutil implements functionality the test suites consume.
Package testutil implements functionality the test suites consume.
Package replay implements helpers for when replaying requests.
Package replay implements helpers for when replaying requests.
Package request implements requested-related functionality.
Package request implements requested-related functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL