Giter Site home page Giter Site logo

config-file-validator's Introduction

Config File Validator

Apache 2 License Go Reference Go Report Card Pipeline Status

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 configuration files.

Where can you use this tool?

  • In a CI/CD pipeline as a quality gate
  • On your desktop to validate configuration files as you write them
  • As a library within your existing go code

What types of files are supported?

  • XML
  • JSON
  • YAML
  • TOML

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 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 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

Exclude dirs

Exclude subdirectories in the search path

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

Exclude Dirs Run

Container Run

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

Standard Run

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

CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64 \
go build \
-ldflags='-w -s -extldflags "-static"' \
-tags netgo \
-o validator \
cmd/validator/validator.go

Install

cp ./validator /usr/local/bin/
chmod +x /usr/local/bin/validator

Windows

Build

CGO_ENABLED=0 \
GOOS=windows \
GOARCH=amd64 \
go build \
-ldflags='-w -s -extldflags "-static"' \
-tags netgo \
-o validator.exe \
cmd/validator/validator.go

Install

mkdir -p 'C:\Program Files\validator'
cp .\validator.exe 'C:\Program Files\validator'
[Environment]::SetEnvironmentVariable("C:\Program Files\validator", $env:Path, [System.EnvironmentVariableTarget]::Machine)

Docker

You can also use the provided Dockerfile to build the config file validator tool in a container

docker build . -t config-file-validator

Contributing

We welcome contributions! Please refer to our contributing guide

License

The Config File Validator is released under the Apache 2.0 License

config-file-validator's People

Contributors

jenskeivik avatar kehoecj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.