Skip to content

Commit

Permalink
Merge Release/v1.7.0 into Master (#1211)
Browse files Browse the repository at this point in the history
* typo: fix docs/example markdown lint

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: code span on function prototype of bfe callback

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/introduction markdown lint and syntax

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/installation markdown lint and syntax

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/faq markdown lint and syntax

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/modules markdown lint

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/operation markdown lint

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/monitor markdown lint and syntax

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Add en_us/condition/request/context.md

Signed-off-by: Song Jian <[email protected]>

* Add zh_cn/condition/request/context.md

Signed-off-by: Song Jian <[email protected]>

* add req_context_value_in() to condition_primitive_index.md and adjust sequence (#1010)

Signed-off-by: Song Jian <[email protected]>

* ci: add markdown lint action

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix docs/condition markdown lints

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Revert "chore: add typos in pre-commit"

Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_balance spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_basic BOM

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_config spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_fcgi spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_http bfe_server spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_http2 spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_module spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: format bfe_modules/mod_userid

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_route spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_spdy spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: fix bfe_tls spelling

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: format bfe_util/socket_util

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* chore: ignore log rotate files

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* typo: remove dot at the end

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Fix typo in  mod_geo (#1029)

Signed-off-by: suhang <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Add staticcheck pre-commit hook (#1019)

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Add precommit hook for markdownlint (#1038)

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Evict the oldest conn when the conn pool exceeds its limit (#1044)

Signed-off-by: chenchen.ccqy66 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* import code-lint workflow job (#1037)

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix go.yaml dependency

Signed-off-by: Song Jian <[email protected]>

* fix arm build error in golang1.18

Signed-off-by: Song Jian <[email protected]>

* refactor: replace strings.Replace with strings.ReplaceAll

strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.

Signed-off-by: Eng Zer Jun <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Create some slices with enough capacity (#1054)

Signed-off-by: chenchen.ccqy66 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update ci.yml (#1061)

Signed-off-by: Song Jian <[email protected]>

* fix build failed on macos (#1067)

Signed-off-by: Song Jian <[email protected]>

* Make some optimization for leastConnsBalance (#1062)

Signed-off-by: likepeng <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Fix some unreachable code in unit tests (#1068)

Signed-off-by: Abirdcfly <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Support HTTP/2 fingerprint (#1072)

Signed-off-by: xqbumu <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* update v1.6.0 changelog

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* update changelog and version file

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update CHANGELOG.md

fix minor typo

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update condition_grammar.md

fix typos

Signed-off-by: Song Jian <[email protected]>

* Update README.md

Signed-off-by: Song Jian <[email protected]>

* update mkdocs yml and download link for v1.5 and v1.6 (#1084)

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Resolved #800 support test configuration

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update MAINTAINERS.md

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update MAINTAINERS.md

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* update maintainers.md

Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix some typo (#1113)

Signed-off-by: cui fliter <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Update ci.yml

Signed-off-by: Song Jian <[email protected]>

* Update ADOPTERS.md (#1123)

Signed-off-by: Benjamin <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* build(deps): bump golang.org/x/sys (#1101)

Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.0.0-20211216021012-1d35b9e2eb4e to 0.1.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Song Jian <[email protected]>

* remove TestSetKeepAlive

Signed-off-by: liangchuan <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* remove TestSetKeepAlive

Signed-off-by: liangchuan <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Resubmit with Signed-off-by line

Signed-off-by: liangchuan <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Resubmit with Signed-off-by line

Signed-off-by: liangchuan <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* http2: close connections when receiving too many headers (#1156)

Maintaining HPACK state requires that we parse and process all HEADERS and CONTINUATION frames on a connection. When a request's headers exceed MaxHeaderBytes, we don't allocate memory to store the excess headers but we do parse them. This permits an attacker to cause an HTTP/2 endpoint to read arbitrary amounts of header data, all associated with a request which is going to be rejected. These headers can include Huffman-encoded data which is significantly more expensive for the receiver to decode than for an attacker to send.

Set a limit on the amount of excess header frames we will process before closing a connection.

This is CVE-2023-45288 and Go issue https://go.dev/issue/65051.

Signed-off-by: Song Jian <[email protected]>

* Update Dockerfile to support multiarch build (#1120)

Replace go compile args to TARGETOS and TARGETARCH to support multiarch compile

Signed-off-by: Allen Chen <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Fix format issue in bfe_http/request_test.go (#1163)

Signed-off-by: cuishuang <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* Temporarily remove some test cases using legacy test data (#1193)

Signed-off-by: Song Jian <[email protected]>

* The experimental `dynamic plugin` is deprecated (#1197)

Signed-off-by: Song Jian <[email protected]>

* Update versions of some thirdpaty modules (#1198)

Fix broken unit tests

Signed-off-by: Song Jian <[email protected]>

* Upgrade third-party modules for security reasons (#1201)

Remove duplicated code lint workflow

Signed-off-by: Sijie Yang <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* bfe_wasm

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* remove v2

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* remove redundant codes

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix OnPluginStart

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* refine codes

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix.

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix nil

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* rename package & remove some obsolete lines.

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* refine

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix & refine

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* docs of mod_wasmplugin

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* add link in summary.md to mod_wasmplugin

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* fix "bfe_http : readloop goroutine leak #1209"

Signed-off-by: xuleiming <[email protected]>
Signed-off-by: Song Jian <[email protected]>

* update changlog and version file for v1.7.0

Signed-off-by: Song Jian <[email protected]>

---------

Signed-off-by: kwanhur <[email protected]>
Signed-off-by: Song Jian <[email protected]>
Signed-off-by: suhang <[email protected]>
Signed-off-by: chenchen.ccqy66 <[email protected]>
Signed-off-by: Eng Zer Jun <[email protected]>
Signed-off-by: likepeng <[email protected]>
Signed-off-by: Abirdcfly <[email protected]>
Signed-off-by: xqbumu <[email protected]>
Signed-off-by: clarinette9 <[email protected]>
Signed-off-by: cui fliter <[email protected]>
Signed-off-by: Benjamin <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: liangchuan <[email protected]>
Signed-off-by: Allen Chen <[email protected]>
Signed-off-by: cuishuang <[email protected]>
Signed-off-by: Sijie Yang <[email protected]>
Signed-off-by: xuleiming <[email protected]>
Co-authored-by: kwanhur <[email protected]>
Co-authored-by: Sijie Yang <[email protected]>
Co-authored-by: Miles Zhang <[email protected]>
Co-authored-by: blinkbean <[email protected]>
Co-authored-by: wolfCoder <[email protected]>
Co-authored-by: daimg <[email protected]>
Co-authored-by: Eng Zer Jun <[email protected]>
Co-authored-by: kezhenxu94 <[email protected]>
Co-authored-by: supermario1990 <[email protected]>
Co-authored-by: cooper-li <[email protected]>
Co-authored-by: Abirdcfly <[email protected]>
Co-authored-by: 卜木 <[email protected]>
Co-authored-by: cui fliter <[email protected]>
Co-authored-by: Benjamin <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: liangchuan <[email protected]>
Co-authored-by: z8n24 <[email protected]>
Co-authored-by: watchword <[email protected]>
Co-authored-by: xuleiming <[email protected]>
Co-authored-by: Song Jian <[email protected]>
  • Loading branch information
21 people authored Jan 19, 2025
1 parent e22ca37 commit b1f1c66
Show file tree
Hide file tree
Showing 68 changed files with 2,102 additions and 473 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.21

# Build
- name: Build
Expand All @@ -75,8 +75,8 @@ jobs:
- name: setup Python
uses: actions/setup-python@v2
with:
python-version: '2.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python -m SimpleHTTPServer 8181&
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- run: python3 -m http.server 8181&

# Modify Conf and Run
- name: Run
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ coverage.txt
.vscode/*
bfe
dist/*
conf/wasm_plugin

.DS_Store
32 changes: 0 additions & 32 deletions .markdownlint.yml

This file was deleted.

2 changes: 2 additions & 0 deletions ADOPTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Some of our users include:

* [Haier](https://www.haier.com)

* [PITS Global Data Recovery Services](https://pitsdatarecovery.net/)

* [Postal Savings Bank of China](https://www.psbc.com)

* [Resolink](https://www.crresolink.com.cn)
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,46 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.7.0] - 2025-01-19

### Added

- Support building docker images for multiple architectures
- Support WASM to allow dynamic plugin

### Fixed

- Upgrade versions of some third-paty modules for security reasons
- Fix format issue in bfe_http/request_test.go
- Temporarily remove some test cases using legacy test data
- mod_tcp_keepalive: fix broken unit tests
- http2: close connections when receiving too many headers
- Fix readloop goroutine leak

### Removed

- The previous experimental dynamic plugin is deprecated

## [v1.6.0] - 2022-10-21

### Added

- Allow user to disable monitor port ([Issue #936](https://github.com/bfenetworks/bfe/issues/936))
- Support HTTP2 fingerprint ([Issue #1071](https://github.com/bfenetworks/bfe/issues/1071))
- Documents optimization

### Changed

- Optimize idle connection handling ([Pull #1044](https://github.com/bfenetworks/bfe/pull/1044))
- Performance optimize in smooth least connection balancing algorithm([Pull #1062](https://github.com/bfenetworks/bfe/pull/1062))
- Miscellaneous golang dependency updates
- Miscellaneous improvements in makefile and other CI tools

### Fixed

- mod_trust_clientip: fix incorrect private IP address range ([Issue #856](https://github.com/bfenetworks/bfe/issues/856))
- arm build error in golang 1.18

## [v1.6.0] - 2022-10-21

### Added
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM golang:1.17.5-alpine3.15 AS build
FROM --platform=${BUILDPLATFORM} golang:1.17.5-alpine3.15 AS build
ARG TARGETARCH
ARG TARGETOS

WORKDIR /bfe
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=`cat VERSION`"
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags "-X main.version=`cat VERSION`"

FROM alpine:3.15 AS run
RUN apk update && apk add --no-cache ca-certificates
Expand Down
14 changes: 9 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ This file lists who are the maintainers of the BFE project. The responsibilities

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Miao Zhang](mailto:zhangmiao02@baidu.com) | [mileszhang2016](https://github.com/mileszhang2016) | Baidu |
| [Sijie Yang](mailto:[email protected]) | [iyangsj](https://github.com/iyangsj) | Baidu |
| [Miao Zhang](mailto:zhangmiao@yf-networks.com) | [mileszhang2016](https://github.com/mileszhang2016) | Yingfei Networks |
| [Sijie Yang](mailto:[email protected]) | [iyangsj](https://github.com/iyangsj) | Tencent |

## Senior Maintainers

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Sijie Yang](mailto:[email protected]) | [iyangsj](https://github.com/iyangsj) | Baidu |
| [Sijie Yang](mailto:[email protected]) | [iyangsj](https://github.com/iyangsj) | Tencent |

## Maintainers

| Name | GitHub ID | Affiliation |
| ---- | --------- | ----------- |
| [Derek Zheng](mailto:[email protected]) | [shanhuhai5739](https://github.com/shanhuhai5739) | Kuaishou |
| [Xiaofei Yu](mailto:[email protected]) | [xiaofei0800](https://github.com/xiaofei0800) | Baidu |
| [Xiaofei Yu](mailto:[email protected]) | [xiaofei0800](https://github.com/xiaofei0800) | Tencent |
| [Wensi Yang](mailto:[email protected]) | [tianxinheihei](https://github.com/tianxinheihei) | ByteDance |
| [Kaiyu Zheng](mailto:[email protected]) | [kaiyuzheng](https://github.com/kaiyuzheng) | ByteDance |
| [Yuqi Xiao](mailto:[email protected]) | [Yuqi Xiao](https://github.com/YuqiXiao) | Baidu |
| [Yuqi Xiao](mailto:[email protected]) | [YuqiXiao](https://github.com/YuqiXiao) | ByteDance |
| [Wei Wei](mailto:[email protected]) | [weiwei99](https://github.com/weiwei99) | Baidu |
| [Andy Liang](mailto:[email protected]) | [andyxmu](https://github.com/andyxmu) | Yingfei Networks |
| [Leiming Xu](mailto:[email protected]) | [xuleiming](https://github.com/xuleiming) | Yingfei Networks |
| [Jian Song](mailto:[email protected]) | [clarinette9](https://github.com/clarinette9) | Yingfei Networks |
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ strip: prepare compile-strip package
# make prepare, download dependencies
prepare: prepare-dep prepare-gen
prepare-dep:
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc@latest)
prepare-gen:
cd "bfe_basic/condition/parser" && $(GOGEN)

Expand Down Expand Up @@ -117,7 +117,7 @@ package:
# make deps
deps:
$(call PIP_INSTALL_PKG, pre-commit)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc)
$(call INSTALL_PKG, goyacc, golang.org/x/tools/cmd/goyacc@latest)
$(call INSTALL_PKG, staticcheck, honnef.co/go/tools/cmd/staticcheck)
$(call INSTALL_PKG, license-eye, github.com/apache/skywalking-eyes/cmd/license-eye@latest)

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ Besides, we also implement [BFE Ingress Controller](https://github.com/bfenetwor
- [English version](https://www.bfe-networks.net/en_us/ABOUT/)
- [Chinese version](https://www.bfe-networks.net/zh_cn/ABOUT/)

## Book

- [In-depth Understanding of BFE](https://github.com/baidu/bfe-book) (Released in Feb 2023)

This book focuses on BFE open source project, introduces the relevant technical principles of network access, explains the design idea of BFE open source software, and how to build a network front-end platform based on BFE open source software. Readers with development capabilities can also develop BFE extension modules according to their own needs or contribute code to BFE open source projects according to the instructions in this book.


## Contributing

- Please create an issue in [issue list](http://github.com/bfenetworks/bfe/issues).
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.0
1.7.0
28 changes: 24 additions & 4 deletions bfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var (
showVersion = flag.Bool("v", false, "to show version of bfe")
showVerbose = flag.Bool("V", false, "to show verbose information about bfe")
debugLog = flag.Bool("d", false, "to show debug log (otherwise >= info)")
testConf = flag.Bool("t", false, "test configuration and exit")
)

var version string
Expand Down Expand Up @@ -74,7 +75,12 @@ func main() {
logSwitch = "DEBUG"
bfe_debug.DebugIsOpen = true
} else {
logSwitch = "INFO"
// ignore under ERROR level
if *testConf {
logSwitch = "ERROR"
} else {
logSwitch = "INFO"
}
bfe_debug.DebugIsOpen = false
}

Expand All @@ -84,7 +90,7 @@ func main() {
log4go.SetLogFormat(log4go.FORMAT_DEFAULT_WITH_PID)
log4go.SetSrcLineForBinLog(false)

err = log.Init("bfe", logSwitch, *logPath, *stdOut, "midnight", 7)
err = log.Init("bfe", logSwitch, *logPath, *stdOut || *testConf, "midnight", 7)
if err != nil {
fmt.Printf("bfe: err in log.Init():%s\n", err.Error())
bfe_util.AbnormalExit()
Expand All @@ -97,10 +103,13 @@ func main() {
config, err = bfe_conf.BfeConfigLoad(confPath, *confRoot)
if err != nil {
log.Logger.Error("main(): in BfeConfigLoad():%s", err.Error())
if *testConf {
fmt.Printf("bfe: configuration file %s test failed\n", confPath)
}
bfe_util.AbnormalExit()
}

// maximum number of CPUs (GOMAXPROCS) defaults to runtime.CPUNUM
// maximum number of CPUs (GOMAXPROCS) defaults to runtime.CPUNUM
// if running on machine, or CPU quota if running on container
// (with the help of "go.uber.org/automaxprocs").
// here, we change maximum number of cpus if the MaxCpus is positive.
Expand All @@ -112,11 +121,22 @@ func main() {
bfe_debug.SetDebugFlag(config.Server)

// start and serve
if err = bfe_server.StartUp(config, version, *confRoot); err != nil {
if err = bfe_server.StartUp(config, version, *confRoot, *testConf); err != nil {
log.Logger.Error("main(): bfe_server.StartUp(): %s", err.Error())
}

// waiting for logger finish jobs
time.Sleep(1 * time.Second)
log.Logger.Close()

// output final configuration test result
if *testConf {
if err != nil {
fmt.Printf("bfe: configuration file %s test failed\n", confPath)
bfe_util.AbnormalExit()
} else {
fmt.Printf("bfe: configuration file %s test is successful\n", confPath)
bfe_util.NormalExit()
}
}
}
Loading

0 comments on commit b1f1c66

Please sign in to comment.