forked from runatlantis/atlantis
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add autodiscover enabled feature (runatlantis#3895)
* add flag to allow the user disable the autodiscover * add global config and doc * feat: Implement autodiscover.mode * fix: Minor doc fixes * fix: Small fixes to docs/indent/tests * fix: Line length, quoting, function comments * fix: Add a few more tests and remove newlines * fix: Always camel case never snake --------- Co-authored-by: Marcelo Medeiros <[email protected]> Co-authored-by: nitrocode <[email protected]> Co-authored-by: PePe Amengual <[email protected]>
- Loading branch information
Showing
22 changed files
with
822 additions
and
35 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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package raw | ||
|
||
import ( | ||
validation "github.com/go-ozzo/ozzo-validation" | ||
"github.com/runatlantis/atlantis/server/core/config/valid" | ||
) | ||
|
||
var DefaultAutoDiscoverMode = valid.AutoDiscoverAutoMode | ||
|
||
type AutoDiscover struct { | ||
Mode *valid.AutoDiscoverMode `yaml:"mode,omitempty"` | ||
} | ||
|
||
func (a AutoDiscover) ToValid() *valid.AutoDiscover { | ||
var v valid.AutoDiscover | ||
|
||
if a.Mode != nil { | ||
v.Mode = *a.Mode | ||
} else { | ||
v.Mode = DefaultAutoDiscoverMode | ||
} | ||
|
||
return &v | ||
} | ||
|
||
func (a AutoDiscover) Validate() error { | ||
res := validation.ValidateStruct(&a, | ||
// If a.Mode is nil, this should still pass validation. | ||
validation.Field(&a.Mode, validation.In(valid.AutoDiscoverAutoMode, valid.AutoDiscoverDisabledMode, valid.AutoDiscoverEnabledMode)), | ||
) | ||
return res | ||
} | ||
|
||
func DefaultAutoDiscover() *valid.AutoDiscover { | ||
return &valid.AutoDiscover{ | ||
Mode: DefaultAutoDiscoverMode, | ||
} | ||
} |
Oops, something went wrong.