Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schumacherfm/runservicerun
Run Service Run! Starts multiple *http.Server (or other services) and terminates on os.Signal with a graceful shutdown. 🎽
https://github.com/schumacherfm/runservicerun
Last synced: 23 days ago
JSON representation
Run Service Run! Starts multiple *http.Server (or other services) and terminates on os.Signal with a graceful shutdown. 🎽
- Host: GitHub
- URL: https://github.com/schumacherfm/runservicerun
- Owner: SchumacherFM
- License: apache-2.0
- Created: 2019-06-11T19:18:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-29T20:04:02.000Z (over 1 year ago)
- Last Synced: 2024-06-21T16:58:09.818Z (7 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# runservicerun
Run Service Run! Starts multiple *http.Server (or other services) and terminates
on os.Signal with a graceful shutdown. 🎽```go
nullHandler := http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})err := runservicerun.Go(runservicerun.Options{
Signals: []os.Signal{syscall.SIGUSR1},
LogError: logFn,
LogInfo: logFn,
},
runservicerun.WithHTTPHandler(":7878", nullHandler),
runservicerun.WithHTTPServer(&http.Server{
Addr: ":7879",
Handler: nullHandler,
}),
runservicerun.WithHTTPHandlerTLS(":7880", "testdata/cert.crt", "testdata/key.pem", &tls.Config{InsecureSkipVerify: true}, nullHandler),
runservicerun.WithHTTPServerTLS("testdata/cert.crt", "testdata/key.pem", &http.Server{
Addr: ":7881",
Handler: nullHandler,
TLSConfig: &tls.Config{InsecureSkipVerify: true},
}),
runservicerun.WithCloserBefore("testCloserB", ioutil.NopCloser(nil)),
runservicerun.WithCloserAfter("testCloserA", ioutil.NopCloser(nil)),
runservicerun.WithStartFunc("testStart", func() error { println("Started something") return nil }),
)
if err != nil {
panic(err) // or any other way to handle this error
}
```# Contribute
Send me a pull request or open an issue if you encounter a bug or something can
be improved!Multi-time pull request senders gets collaborator access.
# License
[Cyrill Schumacher](https://github.com/SchumacherFM) - [My pgp public key](https://www.schumacher.fm/cyrill.asc)
Copyright 2019 Cyrill Schumacher All Rights Reserved.
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 athttp://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.