Improve indentation of generated nginx.conf (#2296)
This commit is contained in:
parent
ee30c55dfc
commit
ab8349008a
3 changed files with 50 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
// rootfs/etc/nginx/nginx.conf
|
||||
// rootfs/etc/nginx/template/nginx.tmpl
|
||||
// rootfs/ingress-controller/clean-nginx-conf.sh
|
||||
// rootfs/ingress-controller/indent.sh
|
||||
// DO NOT EDIT!
|
||||
|
||||
package file
|
||||
|
@ -194,7 +195,7 @@ func etcNginxTemplateNginxTmpl() (*asset, error) {
|
|||
return a, nil
|
||||
}
|
||||
|
||||
var _ingressControllerCleanNginxConfSh = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x92\x41\x6b\xe3\x48\x10\x85\xef\xfa\x15\x6f\x2d\x83\x77\x17\x47\x9d\x78\x0f\x0b\xc9\xc9\x9b\x64\x19\x91\x60\x43\xe4\x4c\x08\x98\x40\xbb\x55\x96\x0a\xa4\x6e\x4d\x75\x2b\xb6\x99\x99\xff\x3e\xb4\xe2\xcc\xc4\x8c\x8e\x55\x4f\xfd\xbe\x7a\x55\xe9\x1f\x6a\xc3\x56\x6d\xb4\xaf\x93\x24\xc5\xb5\xeb\x0e\xc2\x55\x1d\x30\x3b\xbf\xf8\x17\xab\x9a\x70\xd7\x6f\x48\x2c\x05\xf2\x98\xf7\xa1\x76\xe2\xb3\x24\x4d\x52\xdc\xb3\x21\xeb\xa9\x44\x6f\x4b\x12\x84\x9a\x30\xef\xb4\xa9\xe9\xbd\x33\xc5\x67\x12\xcf\xce\x62\x96\x9d\xe3\xcf\x28\x18\x1d\x5b\xa3\xbf\xae\x92\x14\x07\xd7\xa3\xd5\x07\x58\x17\xd0\x7b\x42\xa8\xd9\x63\xcb\x0d\x81\xf6\x86\xba\x00\xb6\x30\xae\xed\x1a\xd6\xd6\x10\x76\x1c\xea\xc1\xe6\xf8\x48\x96\xa4\x78\x3e\x3e\xe1\x36\x41\xb3\x85\x86\x71\xdd\x01\x6e\xfb\x51\x07\x1d\x06\xe0\xf8\xd5\x21\x74\x97\x4a\xed\x76\xbb\x4c\x0f\xb0\x99\x93\x4a\x35\x6f\x42\xaf\xee\xf3\xeb\xdb\x45\x71\x7b\x36\xcb\xce\x87\x5f\x1e\x6d\x43\xde\x43\xe8\x4b\xcf\x42\x25\x36\x07\xe8\xae\x6b\xd8\xe8\x4d\x43\x68\xf4\x0e\x4e\xa0\x2b\x21\x2a\x11\x5c\xe4\xdd\x09\x07\xb6\xd5\x14\xde\x6d\xc3\x4e\x0b\x25\x29\x4a\xf6\x41\x78\xd3\x87\x93\xb0\xde\xe9\xd8\x9f\x08\x9c\x85\xb6\x18\xcd\x0b\xe4\xc5\x08\xff\xcd\x8b\xbc\x98\x26\x29\x9e\xf2\xd5\xa7\xe5\xe3\x0a\x4f\xf3\x87\x87\xf9\x62\x95\xdf\x16\x58\x3e\xe0\x7a\xb9\xb8\xc9\x57\xf9\x72\x51\x60\xf9\x3f\xe6\x8b\x67\xdc\xe5\x8b\x9b\x29\x88\x43\x4d\x02\xda\x77\x12\xf9\x9d\x80\x63\x8c\x54\xc6\xcc\x0a\xa2\x13\x80\xad\x7b\x03\xf2\x1d\x19\xde\xb2\x41\xa3\x6d\xd5\xeb\x8a\x50\xb9\x57\x12\xcb\xb6\x42\x47\xd2\xb2\x8f\xcb\xf4\xd0\xb6\x4c\x52\x34\xdc\x72\xd0\x61\xa8\xfc\x36\x54\x16\x6f\x69\x15\xd7\xe9\x8d\x70\x17\x20\xd4\xba\x57\xf2\x30\xce\x7a\x32\x7d\xe0\x57\x02\xb5\x5d\x38\xa0\x61\x4b\x3e\x26\x67\x2b\xb6\xfb\xcc\x38\xbb\x8d\xc1\xfb\xe8\x1a\xaf\x8b\x3d\x5a\x27\x04\x1f\x27\x88\xe0\xda\xa2\x1f\xba\x1a\x95\x83\x50\x45\xfb\x64\x98\xaa\x8c\xc7\xd2\x6a\x5b\xfa\xcb\x24\xc5\x45\x76\x34\x1d\xb8\x84\x42\x2f\x16\x46\x8b\x30\x09\x4c\xad\x45\x9b\x40\xa2\x7c\x92\x62\xf6\x53\xfa\x01\x29\x49\xf1\x4f\xac\x77\x8d\x36\x84\xb6\x6f\x02\x47\xff\x8f\x8a\x88\x77\x46\x98\x78\xb5\x16\xa5\xaa\x09\xbe\xe1\x57\xe9\x05\xf8\x7b\xac\xd6\x93\xf1\x64\x6d\x4f\x7b\xea\x65\xac\xbe\x2e\xae\xd4\xcb\xda\x8e\xd5\xcd\xd5\xf7\x49\xf2\x23\x00\x00\xff\xff\x3b\xba\x15\x8d\x85\x03\x00\x00")
|
||||
var _ingressControllerCleanNginxConfSh = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x92\x51\x6f\xdb\x36\x14\x85\xdf\xf9\x2b\xce\x22\x03\x69\x87\x54\x4c\xbd\x87\x01\x0d\xf6\xa0\x3a\x1e\x2a\xb4\xb0\x06\x4b\x59\x51\xc0\x48\x41\x53\xd7\xd2\x05\x24\x52\x23\xa9\xd8\x46\x96\xff\x3e\x50\x75\x36\x1b\xd3\x23\xcf\x11\xcf\x77\x0f\x6f\xf2\x93\xdc\xb2\x91\x5b\xe5\x5b\x21\x12\x2c\xec\x70\x74\xdc\xb4\x01\xf3\xdb\xf7\xbf\xa2\x6a\x09\x9f\xc7\x2d\x39\x43\x81\x3c\xb2\x31\xb4\xd6\xf9\x54\x24\x22\xc1\x17\xd6\x64\x3c\xd5\x18\x4d\x4d\x0e\xa1\x25\x64\x83\xd2\x2d\xbd\x2a\x37\xf8\x93\x9c\x67\x6b\x30\x4f\x6f\xf1\x26\x1a\xae\x4e\xd2\xd5\xdb\x3b\x91\xe0\x68\x47\xf4\xea\x08\x63\x03\x46\x4f\x08\x2d\x7b\xec\xb8\x23\xd0\x41\xd3\x10\xc0\x06\xda\xf6\x43\xc7\xca\x68\xc2\x9e\x43\x3b\xc5\x9c\x2e\x49\x45\x82\x6f\xa7\x2b\xec\x36\x28\x36\x50\xd0\x76\x38\xc2\xee\xce\x7d\x50\x61\x02\x8e\x5f\x1b\xc2\xf0\x41\xca\xfd\x7e\x9f\xaa\x09\x36\xb5\xae\x91\xdd\x0f\xa3\x97\x5f\xf2\xc5\x72\x55\x2e\xdf\xcd\xd3\xdb\xe9\x97\x07\xd3\x91\xf7\x70\xf4\xd7\xc8\x8e\x6a\x6c\x8f\x50\xc3\xd0\xb1\x56\xdb\x8e\xd0\xa9\x3d\xac\x83\x6a\x1c\x51\x8d\x60\x23\xef\xde\x71\x60\xd3\xdc\xc0\xdb\x5d\xd8\x2b\x47\x22\x41\xcd\x3e\x38\xde\x8e\xe1\xa2\xac\x57\x3a\xf6\x17\x06\x6b\xa0\x0c\xae\xb2\x12\x79\x79\x85\x8f\x59\x99\x97\x37\x22\xc1\xd7\xbc\xfa\x54\x3c\x54\xf8\x9a\xad\xd7\xd9\xaa\xca\x97\x25\x8a\x35\x16\xc5\xea\x3e\xaf\xf2\x62\x55\xa2\xf8\x1d\xd9\xea\x1b\x3e\xe7\xab\xfb\x1b\x10\x87\x96\x1c\xe8\x30\xb8\xc8\x6f\x1d\x38\xd6\x48\x75\xec\xac\x24\xba\x00\xd8\xd9\x1f\x40\x7e\x20\xcd\x3b\xd6\xe8\x94\x69\x46\xd5\x10\x1a\xfb\x44\xce\xb0\x69\x30\x90\xeb\xd9\xc7\xc7\xf4\x50\xa6\x16\x09\x3a\xee\x39\xa8\x30\x9d\xfc\x6f\xa8\x34\xee\x52\x15\x9f\xd3\x6b\xc7\x43\x80\xa3\xde\x3e\x91\x87\xb6\xc6\x93\x1e\x03\x3f\x11\xa8\x1f\xc2\x11\x1d\x1b\xf2\xb1\x39\xd3\xb0\x39\xa4\xda\x9a\x5d\x2c\xde\xc7\xd4\xb8\x5d\xec\xd1\x5b\x47\xf0\x71\x82\x08\xae\x0c\xc6\x49\x55\x68\x2c\x1c\x35\x74\x10\xd3\x54\x75\x5c\x96\x5e\x99\xda\x7f\x10\x09\xde\xa7\xa7\xd0\x89\xcb\x51\x18\x9d\x81\x56\xce\x31\x39\xe8\x56\x39\xa5\x03\x39\xe9\x45\x82\xf9\xbf\xd6\x33\x24\x91\xe0\x97\x78\x3e\x74\x4a\x13\xfa\xb1\x0b\x1c\xf3\xcf\x1d\xa2\x5c\xac\xf3\x3f\xaa\xef\xeb\xa2\xa8\x7e\x9b\xbd\xa9\xd9\x19\xd5\x13\x66\xcf\x1f\xb3\xf2\xd3\xf7\xb2\x78\x58\x2f\x96\x2f\x6f\x85\x88\x63\xbc\x23\x5c\x7b\xb9\x71\x52\x36\xd7\xf8\x1b\xff\x1d\x3d\x02\x3f\xcf\xe4\xe6\x7a\x76\xbd\x31\x97\x9a\x7c\x9c\xc9\xe7\xd5\x9d\x7c\xdc\x98\x99\xbc\xbf\x7b\x89\xda\xec\xf9\x2c\xf3\x45\xb2\xa9\xc9\x84\xd4\xb7\xe2\x9f\x00\x00\x00\xff\xff\x9d\xb0\x0f\x47\xc8\x03\x00\x00")
|
||||
|
||||
func ingressControllerCleanNginxConfShBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
|
@ -214,6 +215,26 @@ func ingressControllerCleanNginxConfSh() (*asset, error) {
|
|||
return a, nil
|
||||
}
|
||||
|
||||
var _ingressControllerIndentSh = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x64\x92\x5f\x6f\xe2\x38\x14\xc5\xdf\xf3\x29\xce\x26\x5b\x09\x04\x24\x94\x5d\xd4\x3f\x2c\x0f\x6c\xdb\xd1\x44\xad\x40\x6a\xe8\x54\xd5\x30\x23\x39\xc9\x4d\x72\x35\xc1\xce\xd8\x4e\x03\x42\x7c\xf7\x51\x52\x2a\x4d\x35\x7e\x3c\xe7\xf8\xfa\xe7\x63\x7b\x7f\x05\xb5\xd1\x41\xcc\x32\x10\xcd\x0f\x8c\x32\xc7\xf1\x70\xa3\xaa\xbd\xe6\xbc\xb0\x98\x8c\xcf\x2f\xb0\x2e\x08\xf7\x75\x4c\x5a\x92\x25\x83\x45\x6d\x0b\xa5\x8d\xef\x78\x8e\x87\x07\x4e\x48\x1a\x4a\x51\xcb\x94\x34\x6c\x41\x58\x54\x22\x29\xe8\xdd\x19\xe2\x0b\x69\xc3\x4a\x62\xe2\x8f\xd1\x6b\x03\xee\xc9\x72\xfb\x33\xc7\xc3\x5e\xd5\xd8\x8a\x3d\xa4\xb2\xa8\x0d\xc1\x16\x6c\x90\x71\x49\xa0\x5d\x42\x95\x05\x4b\x24\x6a\x5b\x95\x2c\x64\x42\x68\xd8\x16\xdd\x31\xa7\x21\xbe\xe3\xe1\xe5\x34\x42\xc5\x56\xb0\x84\x40\xa2\xaa\x3d\x54\xf6\x7b\x0e\xc2\x76\xc0\xed\x2a\xac\xad\xae\x83\xa0\x69\x1a\x5f\x74\xb0\xbe\xd2\x79\x50\xbe\x05\x4d\xf0\x10\xde\xdc\x2d\xa3\xbb\xd1\xc4\x1f\x77\x5b\x9e\x64\x49\xc6\x40\xd3\xcf\x9a\x35\xa5\x88\xf7\x10\x55\x55\x72\x22\xe2\x92\x50\x8a\x06\x4a\x43\xe4\x9a\x28\x85\x55\x2d\x6f\xa3\xd9\xb2\xcc\x87\x30\x2a\xb3\x8d\xd0\xe4\x78\x48\xd9\x58\xcd\x71\x6d\x3f\x94\xf5\x4e\xc7\xe6\x43\x40\x49\x08\x09\x77\x11\x21\x8c\x5c\xfc\xbf\x88\xc2\x68\xe8\x78\x78\x0e\xd7\x9f\x57\x4f\x6b\x3c\x2f\x1e\x1f\x17\xcb\x75\x78\x17\x61\xf5\x88\x9b\xd5\xf2\x36\x5c\x87\xab\x65\x84\xd5\x27\x2c\x96\x2f\xb8\x0f\x97\xb7\x43\x10\xdb\x82\x34\x68\x57\xe9\x96\x5f\x69\x70\x5b\x23\xa5\x6d\x67\x11\xd1\x07\x80\x4c\xbd\x01\x99\x8a\x12\xce\x38\x41\x29\x64\x5e\x8b\x9c\x90\xab\x57\xd2\x92\x65\x8e\x8a\xf4\x96\x4d\xfb\x98\x06\x42\xa6\x8e\x87\x92\xb7\x6c\x85\xed\x94\x3f\x2e\xe5\x77\x7f\x49\x53\xca\xd6\xb4\xc5\xb4\xb5\x9b\xeb\x20\xa0\x57\x61\xf8\x95\x7c\x5d\x07\xd9\xe4\x2a\x4e\x2f\x28\x16\x49\x36\xf9\x57\x4c\xc7\xc9\xf4\x72\x92\x5d\x5d\xfc\x23\xa6\x53\x22\x9a\x5c\xfa\x85\xdd\x96\x8e\x73\x30\x75\xdc\x0b\xbe\x7f\xc5\xc6\x7e\x1b\x04\x43\xd7\xed\xcf\x38\xdd\xcd\xc7\x47\x27\xd8\x1c\x82\x43\x62\x77\x83\x41\xa7\x9c\xb7\xca\xb1\x53\x46\xa3\xa3\x73\xe0\x74\xee\xba\xb3\x4c\xe9\x1e\xcf\x39\xdd\xcd\xf8\xbf\xc4\xee\x66\x3c\x18\xf4\x39\x9d\x9b\x4a\xb3\xb4\x59\xcf\x3d\x33\x67\xc6\x1d\x82\xd3\x21\xdc\x8d\x75\xfb\xb3\x37\x03\x9d\xb1\x91\x27\xeb\xef\xf1\xd1\xf9\x15\x00\x00\xff\xff\x25\x9c\x0e\x1f\x2f\x03\x00\x00")
|
||||
|
||||
func ingressControllerIndentShBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_ingressControllerIndentSh,
|
||||
"ingress-controller/indent.sh",
|
||||
)
|
||||
}
|
||||
|
||||
func ingressControllerIndentSh() (*asset, error) {
|
||||
bytes, err := ingressControllerIndentShBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "ingress-controller/indent.sh", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
|
@ -273,6 +294,7 @@ var _bindata = map[string]func() (*asset, error){
|
|||
"etc/nginx/nginx.conf": etcNginxNginxConf,
|
||||
"etc/nginx/template/nginx.tmpl": etcNginxTemplateNginxTmpl,
|
||||
"ingress-controller/clean-nginx-conf.sh": ingressControllerCleanNginxConfSh,
|
||||
"ingress-controller/indent.sh": ingressControllerIndentSh,
|
||||
}
|
||||
|
||||
// AssetDir returns the file names below a certain
|
||||
|
@ -333,6 +355,7 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
|||
}},
|
||||
"ingress-controller": &bintree{nil, map[string]*bintree{
|
||||
"clean-nginx-conf.sh": &bintree{ingressControllerCleanNginxConfSh, map[string]*bintree{}},
|
||||
"indent.sh": &bintree{ingressControllerIndentSh, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
|
||||
|
|
|
@ -21,4 +21,7 @@
|
|||
# 1. remove the return carrier character/s
|
||||
# 2. remove empty lines
|
||||
# 3. replace multiple empty lines
|
||||
sed -e 's/\r//g' | sed -e 's/^ *$/\'$'\n/g' | sed -e '/^$/{N;/^\n$/D;}'
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})
|
||||
|
||||
sed -e 's/\r//g' | sed -e 's/^ *$/\'$'\n/g' | sed -e '/^$/{N;/^\n$/D;}' | ${SCRIPT_ROOT}/indent.sh
|
||||
|
|
22
rootfs/ingress-controller/indent.sh
Executable file
22
rootfs/ingress-controller/indent.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/awk -f
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Credits to https://evasive.ru/f29bd7ebacf24a50c582f973a55eee28.html
|
||||
|
||||
{sub(/^[ \t]+/,"");idx=0}
|
||||
/\{/{ctx++;idx=1}
|
||||
/\}/{ctx--}
|
||||
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}
|
Loading…
Reference in a new issue