fix openbsd

This commit is contained in:
ston1th 2025-01-17 22:06:08 +01:00
commit 6476ebc781
524 changed files with 36106 additions and 11790 deletions

View file

@ -30,9 +30,6 @@ const (
defListen = "127.0.0.1:8080"
defLogFile = "docstore.log"
defRunUser = "docstore"
defRunGroup = "docstore"
defTimeout = 600
tesseractThreads = 1
@ -51,17 +48,6 @@ func initServer(cfg *core.Config) (err error) {
// if err = godrop.PledgePromises("stdio rpath wpath cpath inet fattr flock proc exec id unveil"); err != nil {
// return
// }
dropCfg := godrop.Config{
User: cfg.User,
Group: cfg.Group,
Foreground: cfg.Foreground,
}
err = godrop.Drop(dropCfg, func() (net.Listener, error) {
return net.Listen("tcp", cfg.ListenAddr)
})
if err != nil {
return
}
if err = os.Chdir(cfg.RunDir); err != nil {
return
}
@ -70,7 +56,7 @@ func initServer(cfg *core.Config) (err error) {
return
}
l, err := godrop.GetListener()
l, err := net.Listen("tcp", cfg.ListenAddr)
if err != nil {
return
}
@ -137,12 +123,6 @@ func loadConfig() error {
if config.RunDir == "" {
config.RunDir = defRunDir
}
if config.User == "" {
config.User = defRunUser
}
if config.Group == "" {
config.Group = defRunGroup
}
if config.ListenAddr == "" {
config.ListenAddr = defListen
}
@ -331,18 +311,6 @@ func Run(version string) {
func serverFlags() []cli.Flag {
return []cli.Flag{
cli.StringFlag{
Name: "user, u",
Value: defRunUser,
Usage: "drop privileges to user",
Destination: &config.User,
},
cli.StringFlag{
Name: "group, g",
Value: defRunGroup,
Usage: "drop privileges to group",
Destination: &config.Group,
},
cli.StringFlag{
Name: "listen, l",
Value: defListen,
@ -382,11 +350,6 @@ func serverFlags() []cli.Flag {
Usage: "tesseract oem value (1-4)",
Destination: &config.TesseractOEM,
},
cli.BoolFlag{
Name: "foreground, f",
Usage: "do not fork into the background",
Destination: &config.Foreground,
},
cli.BoolFlag{
Name: "secure, s",
Usage: "enable secure cookie flag",

View file

@ -75,8 +75,6 @@ type Stats struct {
type Config struct {
RunDir string `json:"run_dir,omitempty"`
DataDir string `json:"-"`
User string `json:"user,omitempty"`
Group string `json:"group,omitempty"`
ListenAddr string `json:"listen_addr,omitempty"`
LogFile string `json:"log_file,omitempty"`
Version string `json:"-"`
@ -85,7 +83,6 @@ type Config struct {
CMDTimeout int `json:"cmd_timeout,omitempty"`
TesseractThreads int `json:"tesseract_threads,omitempty"`
TesseractOEM int `json:"tesseract_oem,omitempty"`
Foreground bool `json:"foreground,omitempty"`
SecureCookie bool `json:"secure_cookie,omitempty"`
Debug bool `json:"debug,omitempty"`
WebDav bool `json:"webdav,omitempty"`