Skip to content

Latest commit

 

History

History
130 lines (88 loc) · 4.19 KB

README.md

File metadata and controls

130 lines (88 loc) · 4.19 KB

Nginx Formatter

CodeQL Codecov Security Scan Release Go Report Card Docker Image

ENGLISH | 中文文档

Nginx configuration formatter ~10MB size, support CLI, WebUI, x86, ARM, Linux, macOS.

Download

Download the binaries for your system and architecture from the releases page.

If you use docker, you can use the following command (DockerHub):

docker pull soulteary/nginx-formatter:latest
docker pull soulteary/nginx-formatter:v1.1.1

Usage

Use default parameters to format all configuration files in the current directory:

./nginx-formatter

Common Usage (CLI & WebUI)

Use different indentation symbols (You can use spaces, tabs, , \s, \t) and indentation amounts:

./nginx-formatter -indent=4 -char=" "

CLI Usage

Format the configuration file in the specified directory:

./nginx-formatter -input=./your-dir-path

Format a file somewhere and save it in a new directory:

./nginx-formatter -input=./your-dir-path -output=./your-output-dir

WebUI Usage

Start the web interface:

./nginx-formatter -web

specified the port:

./nginx-formatter -web -port=8123

Docker Usage

There is no difference between using parameters in Docker and the above, for example, we start a Web UI formatting tool service in Docker:

docker run --rm -it -p 8080:8080 soulteary/nginx-formatter:v1.1.1 -web

If you want to format the configuration of the current directory, you can use the program in Docker with a command similar to the following:

docker run --rm -it -v `pwd`:/app soulteary/nginx-formatter:v1.1.1 -input=/app

Full parameters supported

List of parameters supported:

Nginx Formatter

Usage of ./nginx-formatter:
  -char  
    	Indent char, defualt:   (default " ")
  -indent int
    	Indent size, defualt: 2 (default 2)
  -input string
    	Input directory
  -output string
    	Output directory
  -port 8080
    	WebUI Port, defualt: 8080 (default 8080)
  -web false
    	Enable WebUI, defualt: false

Credits

Formatter Components

Runtime dependent Components

Web Components