Skip to content

Commit

Permalink
Updates to the README (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
kehoecj authored Feb 6, 2023
1 parent 6794445 commit 874028e
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 43 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: Go Pipeline

on: push

Expand Down Expand Up @@ -45,8 +45,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Test
run: go test -v ./...


113 changes: 74 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# Config File Validator
<div align="center">
<img src="./img/logo.png" width="200" height="200"/>
<h1>Config File Validator</h1>
</div>

<p align="center">
<a href="https://opensource.org/licenses/Apache-2.0">
<img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="Apache 2 License">
</a>

<a href="https://pkg.go.dev/github.com/Boeing/config-file-validator">
<img src="https://pkg.go.dev/badge/github.com/Boeing/config-file-validator.svg" alt="Go Reference">
</a>

<a href="https://goreportcard.com/report/github.com/Boeing/config-file-validator">
<img src="https://goreportcard.com/badge/github.com/Boeing/config-file-validator" alt="Go Report Card">
</a>

<a href="https://github.com/boeing/config-file-validator/actions/workflows/go.yml">
<img src="https://github.com/boeing/config-file-validator/actions/workflows/go.yml/badge.svg" alt="Pipeline Status">
</a>
</p>

## About
How many deployments have you done that needed to be rolled back due to a missing character in a configuration file in your repo? If you're like most teams that number is greater than zero. The config file validator was created to solve this problem by searching through your project and validating the syntax of all configuation files.
How many deployments have you done that needed to be rolled back due to a missing character in a configuration file in your repo? If you're like most teams that number is greater than zero. The config file validator was created to solve this problem by searching through your project and validating the syntax of all configuration files.

### Where can you use this tool?
* In a CI/CD pipeline as a quality gate
Expand All @@ -14,8 +35,55 @@ How many deployments have you done that needed to be rolled back due to a missin
* YAML
* TOML

## Getting Started
Binaries and a container on Dockerhub will eventually be available but for now the project must be built on an environment that has golang 1.17+ installed.
## Installing
There are several ways to install the config file validator tool

### Using `go install`
If you have a go environment on your desktop you can use [go install](https://go.dev/doc/go-get-install-deprecation) to install the validator executable. The validator executable will be installed to the directory named by the GOBIN environment variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set.

```
go install github.com/Boeing/config-file-validator/cmd/validator
```


### Executables
Executables are available for Linux and Windows (macOS coming soon!). Navigate to the [releases](https://github.com/Boeing/config-file-validator/releases) page to download the latest version. Once the executable has been downloaded it needs to be installed by moving the downloaded file to a location on your OS PATH.

## Using
```
Usage of /validator:
-exclude-dirs string
Subdirectories to exclude when searching for configuration files
-search-path string
The search path for configuration files
```

### Examples
#### Standard Run
```
validator -search-path /path/to/search
```

![Standard Run](./img/standard_run.png)

#### Exclude dirs
Exclude subdirectories in the search path

```
validator -search-path /path/to/search -exclude-dirs=/path/to/search/tests
```

![Exclude Dirs Run](./img/exclude_dirs.png)

#### Container Run
```
docker run -it --rm -v /path/to/config/file/location:/test -search-path=/test
```

![Standard Run](./img/docker_run.png)

## Building from source
The project can be downloaded and built from source using an environment with golang 1.17+ installed. After successful build, the statically-linked binary can be moved to a location on your operating system PATH.

### Linux
#### Build
Expand Down Expand Up @@ -57,47 +125,14 @@ cp .\validator.exe 'C:\Program Files\validator'
```

### Docker
The config file validator can be built as a docker container
```
docker build . -t config-file-validator
```

## Using
```
Usage of /validator:
-exclude-dirs string
Subdirectories to exclude when searching for configuration files
-search-path string
The search path for configuration files
```
You can also use the provided Dockerfile to build the config file validator tool in a container

### Examples
#### Standard Run
```
validator -search-path /path/to/search
```

![Standard Run](./img/standard_run.png)

#### Exclude dirs
Exclude subdirectories in the search path

```
validator -search-path /path/to/search -exclude-dirs=/path/to/search/tests
```

![Exclude Dirs Run](./img/exclude_dirs.png)

#### Container Run
```
docker run -it --rm -v /path/to/config/file/location:/test -search-path=/test
docker build . -t config-file-validator
```

![Standard Run](./img/docker_run.png)

## Contributing
We welcome contributions! Please refer to our [contributing guide](/CONTRIBUTING.md)

## License

The Config File Validator is released under the [Apache 2.0](/LICENSE) License
17 changes: 17 additions & 0 deletions cmd/validator/validator.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/*
Validator recusively scans a directory to search for configuration files and
validates them using the go package for each configuration type.
Currently json, yaml, toml, and xml configuration file types are supported.
Usage:
validator [flags]
The flags are:
-search-path string
The search path for configuration files
-exclude-dirs string
Subdirectories to exclude when searching for configuration files
*/

package main

import (
Expand Down
Binary file added img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 874028e

Please sign in to comment.