Skip to content

Config file hot reload doesn't work #132

Closed

Description

@weibeld

Just downloaded v1.1.2 and tried with a config file containing:

watchconfig = true

[backend]
  datastore = "config"
  baseDN = "dc=glauth,dc=com"

When editing and saving the config file (e.g. adding a user), nothing happens. Actually, GLAuth should reload the config file as defined in the code.

Activity

  1. fanlix commented on Jul 21, 2021

    @fanlix
    Contributor

    v1.1.2 reload not works. ubuntu 20.04.2

  2. fanlix commented on Jul 21, 2021

    @fanlix
    Contributor

    figure this out, it's fsnotify lib & vim/editor/fs problem. origin issue: fsnotify/fsnotify#17

    • pure write works
      • echo xxx > xx.cfg
      • cp xx.cfg xx.cfg works
    • vim xx.cfg, use :w to save, not works.
      • also cause fsnotify quit.
      • set nobackup in vim, works. but we never do this.
      • sublime,....

    my debug log with vim edit config

    16:40:49.048357 doConfig ▶ DEBU 001 Debugging enabled
    16:40:49.048411 startService ▶ DEBU 002 Web API enabled
    16:40:49.048503 startConfigWatcher ▶ NOTI 003 watching Config:sample-simple.cfg
    16:40:49.048553 startConfigWatcher ▶ NOTI 004 watching start...
    16:40:49.048629 NewServer ▶ NOTI 005 Using config backend
    16:40:49.048673 startLDAP ▶ NOTI 006 LDAP server listening on 0.0.0.0:3893
    16:40:49.048741 RunAPI ▶ NOTI 007 Starting HTTP server on 0.0.0.0:5555
    16:40:56.847779 func1 ▶ NOTI 008 watching event: RENAME
    16:40:56.848621 func1 ▶ NOTI 009 watching event: CHMOD
    16:40:56.848717 func1 ▶ NOTI 00a watching event: REMOVE
    

    easy answer

    1. ./glauth -c config.cfg
    2. edit a copy of config file vim config.cfg.edit
    3. when finished , cp config.cfg.edit config.cfg

    or, we can watch the folder for rm/new/rename events.... ?

  3. Fusion commented on Jul 26, 2021

    @Fusion
    Collaborator

    Merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions