-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean application config of Nomad related methods (#3257)
* fly config validate * Remove SetNomadPlatform and SetPlatformVersion methods * Remove SetNomadPlatform and SetDetachedPlatform methods * The less GQL calsl the better * Remove Nomad and Detached from config validation * the less GQL calls the better * remove nomad and detached platforms from appconfig ProcessGroups * Remove appconfig.Config.RawDefinition * remove unused func * No more appconfig.*Platform constants * Remove nomad from comments
- Loading branch information
Showing
30 changed files
with
73 additions
and
987 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
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 |
---|---|---|
@@ -1,54 +1,9 @@ | ||
package appconfig | ||
|
||
import "fmt" | ||
|
||
func (c *Config) EnsureV2Config() error { | ||
return c.v2UnmarshalError | ||
} | ||
|
||
// SetMachinesPlatform informs the TOML marshaller that this config is for the machines platform | ||
func (c *Config) SetMachinesPlatform() error { | ||
if c.v2UnmarshalError != nil { | ||
return c.v2UnmarshalError | ||
} | ||
c.platformVersion = MachinesPlatform | ||
return nil | ||
} | ||
|
||
// SetMachinesPlatform informs the TOML marshaller that this config is for the machines platform | ||
func (c *Config) SetDetachedPlatform() error { | ||
if c.v2UnmarshalError != nil { | ||
return c.v2UnmarshalError | ||
} | ||
c.platformVersion = DetachedPlatform | ||
return nil | ||
} | ||
|
||
// SetNomadPlatform informs the TOML marshaller that this config is for the nomad platform | ||
func (c *Config) SetNomadPlatform() error { | ||
if len(c.RawDefinition) == 0 { | ||
return fmt.Errorf("Can't set platformVersion to Nomad on an empty RawDefinition") | ||
} | ||
c.platformVersion = NomadPlatform | ||
return nil | ||
} | ||
|
||
func (c *Config) SetPlatformVersion(platform string) error { | ||
switch platform { | ||
case MachinesPlatform: | ||
return c.SetMachinesPlatform() | ||
case NomadPlatform: | ||
return c.SetNomadPlatform() | ||
case DetachedPlatform: | ||
return c.SetDetachedPlatform() | ||
case "": | ||
return fmt.Errorf("Empty value as platform version") | ||
default: | ||
return fmt.Errorf("Unknown platform version: '%s'", platform) | ||
} | ||
} | ||
|
||
// ForMachines is true when the config is intended for the machines platform | ||
func (c *Config) ForMachines() bool { | ||
return c.platformVersion == MachinesPlatform | ||
} |
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
Oops, something went wrong.