-
Notifications
You must be signed in to change notification settings - Fork 223
/
freshconfigs.go
39 lines (35 loc) · 1.04 KB
/
freshconfigs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package launch
import (
"github.com/superfly/flyctl/api"
"github.com/superfly/flyctl/internal/appconfig"
)
func freshV2Config(appName string, srcCfg *appconfig.Config) (*appconfig.Config, error) {
newCfg := appconfig.NewConfig()
newCfg.AppName = appName
newCfg.Build = srcCfg.Build
newCfg.PrimaryRegion = srcCfg.PrimaryRegion
newCfg.HTTPService = &appconfig.HTTPService{
InternalPort: 8080,
ForceHTTPS: true,
AutoStartMachines: api.Pointer(true),
AutoStopMachines: api.Pointer(true),
MinMachinesRunning: api.Pointer(0),
}
if err := newCfg.SetMachinesPlatform(); err != nil {
return nil, err
}
return newCfg, nil
}
func freshV1Config(appName string, srcCfg *appconfig.Config, definition *api.Definition) (*appconfig.Config, error) {
newCfg, err := appconfig.FromDefinition(definition)
if err != nil {
return nil, err
}
newCfg.AppName = appName
newCfg.Build = srcCfg.Build
newCfg.PrimaryRegion = srcCfg.PrimaryRegion
if err := newCfg.SetNomadPlatform(); err != nil {
return nil, err
}
return newCfg, nil
}