2017-04-14 16:15:07 -06:00
|
|
|
// Package Paste API.
|
|
|
|
//
|
|
|
|
// the purpose of this application is to provide an application
|
2018-03-14 07:22:14 -06:00
|
|
|
// that is using plain go code to define a paste API
|
2017-04-14 16:15:07 -06:00
|
|
|
//
|
|
|
|
// Terms Of Service:
|
|
|
|
//
|
|
|
|
// there are no TOS at this moment, use at your own risk we take no responsibility
|
|
|
|
//
|
|
|
|
// Schemes: http, https
|
|
|
|
// Host: paste.sour.is
|
|
|
|
// BasePath: /
|
|
|
|
// Version: 0.0.1
|
|
|
|
// License: MIT http://opensource.org/licenses/MIT
|
|
|
|
// Contact: Xuu <me@sour.is> https://sour.is
|
|
|
|
//
|
|
|
|
// Consumes:
|
|
|
|
// - application/json
|
|
|
|
// - text/plain
|
|
|
|
//
|
|
|
|
// Produces:
|
|
|
|
// - application/json
|
|
|
|
// - text/plain
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// swagger:meta
|
2023-10-15 14:27:15 -06:00
|
|
|
package main // import "go.sour.is/paste/cmd/paste"
|
2017-04-14 16:15:07 -06:00
|
|
|
|
|
|
|
import (
|
2018-06-26 10:51:21 -06:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
2020-08-16 09:18:52 -06:00
|
|
|
"syscall"
|
|
|
|
|
2023-10-15 14:27:15 -06:00
|
|
|
_ "go.sour.is/paste/src/docs"
|
|
|
|
_ "go.sour.is/paste/src/routes"
|
2018-03-15 11:13:59 -06:00
|
|
|
"sour.is/x/toolbox/httpsrv"
|
2018-06-25 17:23:13 -06:00
|
|
|
"sour.is/x/toolbox/log"
|
2017-04-14 16:15:07 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
if args["serve"] == true {
|
|
|
|
httpsrv.Run()
|
2018-06-25 17:23:13 -06:00
|
|
|
|
|
|
|
c := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
|
|
|
|
|
|
|
|
s := <-c
|
|
|
|
log.Debugf("Got Signal %d", s)
|
|
|
|
|
|
|
|
httpsrv.Shutdown()
|
|
|
|
log.Debug("DONE")
|
2017-04-14 16:15:07 -06:00
|
|
|
}
|
|
|
|
}
|
2018-03-14 07:18:19 -06:00
|
|
|
|
2020-08-16 09:18:52 -06:00
|
|
|
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger generate spec -o ../../src/docs/public/swagger.json
|