Changeset 67 in code for trunk/cmd


Ignore:
Timestamp:
Feb 7, 2024, 12:26:14 AM (16 months ago)
Author:
yakumo.izuru
Message:

Fix bugs, many other changes

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

Location:
trunk/cmd/mai
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmd/mai/main.go

    r66 r67  
    2222var (
    2323        configfile string
     24        groupname string
     25        username string
    2426)
    2527var conf struct {
    26         group string
    2728        listen string
    2829        staticpath string
    2930        tmplpath string
    30         user string
    3131}
    3232func main() {
     
    4242        conf.tmplpath = "./views"
    4343
    44         if conf.user != "" {
    45                 uid, gid, err := usergroupids(conf.user, conf.group)
     44        if username != "" {
     45                uid, gid, err := usergroupids(username, groupname)
    4646                if err != nil {
    4747                        fmt.Println(err)
     
    259259                }
    260260        })
     261        app.Get("/robots.txt", func(c *fiber.Ctx) error {
     262                return c.SendString("User-Agent: *\nDisallow: /\n")
     263        })
    261264        app.Get("/version", func(c *fiber.Ctx) error {
    262265                return c.JSON(fiber.Map{
  • trunk/cmd/mai/parseflags.go

    r66 r67  
    88func parseFlags() {
    99        flag.StringVar(&configfile, "f", "", "Configuration file")
     10        flag.StringVar(&username, "u", "", "Sets the user to which privilege dropping is done")
     11        flag.StringVar(&groupname, "g", "", "Sets the group to which privilege dropping is done")
    1012        flag.Parse()
    1113}
  • trunk/cmd/mai/readconf.go

    r66 r67  
    1111                return err                                             
    1212        }
    13         conf.group = cfg.Section("mai").Key("group").String()
    1413        conf.listen = cfg.Section("mai").Key("listen").String()
    1514        conf.staticpath = cfg.Section("mai").Key("static").String()
    1615        conf.tmplpath = cfg.Section("mai").Key("templates").String()
    17         conf.user = cfg.Section("mai").Key("user").String()
    1816
    1917        return nil
  • trunk/cmd/mai/usergroupids.go

    r63 r67  
    1515        gid, _ := strconv.Atoi(u.Gid)
    1616
    17         if conf.group != "" {
     17        if groupname != "" {
    1818                g, err := user.LookupGroup(groupname)
    1919                if err != nil {
Note: See TracChangeset for help on using the changeset viewer.