-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0684678
commit 2d6091a
Showing
3 changed files
with
36 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/dorklyorg/dorkly/internal/dorkly" | ||
"os" | ||
) | ||
|
||
const ( | ||
dorklyYamlEnvVar = "DORKLY_YAML" | ||
defaultDorklyYamlInputPath = "project" | ||
) | ||
|
||
var logger = dorkly.GetLogger().Named("Validator") | ||
|
||
func main() { | ||
dorklyYamlInputPath := os.Getenv(dorklyYamlEnvVar) | ||
if dorklyYamlInputPath == "" { | ||
logger.Debugf("Env var [%s] not set. Using default: %s", dorklyYamlEnvVar, defaultDorklyYamlInputPath) | ||
dorklyYamlInputPath = defaultDorklyYamlInputPath | ||
} | ||
l := logger.With("dorklyYamlInputPath", dorklyYamlInputPath) | ||
|
||
p, err := dorkly.ValidateYamlProject(dorklyYamlInputPath) | ||
if err != nil { | ||
l.Fatalf("Failed to validate project yaml files: %v", err) | ||
} | ||
l.With("project", p).Info("Project yaml files validated successfully") | ||
} |
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,7 @@ | ||
package dorkly | ||
|
||
// ValidateYamlProject loads the project yaml files from the given path and validates them. | ||
// It returns a Project struct if the yaml files are valid, otherwise it returns an error. | ||
func ValidateYamlProject(path string) (*Project, error) { | ||
return loadProjectYamlFiles(path) | ||
} |
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