It appears that the default config file installed by the Makefile isn't actually
used.
From the Makefile:
[ -f $(DESTDIR)/etc/soju/config ] || cp -f config.in $(DESTDIR)/etc/soju/config
I think it would be reasonable to set this path as the default value for the
CLI flag, in cmd/soju/main.go:
flag.StringVar(&configPath, "config", "/etc/soju/config", "path to configuration file")
Resolving DESTDIR within the binary might be a little tricky. Does Go have
support for compile-time constants that can be passed through as build
arguments? I suppose it could be ignored for the default value as well though.
Thoughts?
On Friday, July 22nd, 2022 at 17:39, William Brawner <me@wbrawner.com> wrote:
> It appears that the default config file installed by the Makefile isn't actually
> used.
>
> > From the Makefile:
>
> [ -f $(DESTDIR)/etc/soju/config ] || cp -f config.in $(DESTDIR)/etc/soju/config
>
> I think it would be reasonable to set this path as the default value for the
> CLI flag, in cmd/soju/main.go:
>
> flag.StringVar(&configPath, "config", "/etc/soju/config", "path to configuration file")
>
> Resolving DESTDIR within the binary might be a little tricky. Does Go have
> support for compile-time constants that can be passed through as build
> arguments? I suppose it could be ignored for the default value as well though.
> Thoughts?
Yeah. This is by design: users should never run soju as root directly,
and regular users don't have write access to /var/lib/soju/. IOW, users
invoking soju directly won't want to use /etc/soju/config.
The intention is to let distributions create service files which invoke
"soju -config /etc/soju/config", running as a special soju user.
This isn't the greatest thing ever, but I don't have very good ideas to
improve the status quo.