Skip to content
/ fly Public

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

License

Notifications You must be signed in to change notification settings

azazeal/fly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, ", "))
}

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages