~emersion/soju-dev

1

Default Config File

Details
Message ID
<CLMAQ2CRRKVV.3R1YUOKVJ24LY@fractal>
DKIM signature
pass
Download raw message
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?
Details
Message ID
<khtR4GjOOGfuHIzY1pEXJbc8NXI6DhwDia_VVb1pgxQn3IBV2s4_a9e2qzWf6jylIKGg9080P3tJeLXkhFRM9tIOWR-Ulupqlc7CsutY4Js=@emersion.fr>
In-Reply-To
<CLMAQ2CRRKVV.3R1YUOKVJ24LY@fractal> (view parent)
DKIM signature
pass
Download raw message
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.
Reply to thread Export thread (mbox)