maddy(1) was incorrect calling them 'statedir' and 'runtimedir'.
Name with 'dir' is preferred since it is more explicit. Use of
underscores is consistent with other directives.
There is abstraction 'updates pipe' defined for future use with
configuration involving IMAP data replication (e.g. multiple nodes with
maddy instances + PostgreSQL replicas + S3 bucket for messages).
However, for the case of local SQLite3 DB, limited UDS-based
implementation is provided. It solves the problem of maddyctl not being
able to tell the server about modifications it makes. Alternative to
this approach would be to have server actually perform operations and
maddyctl being a dumb API client, but this requires a lot more complex
IPC interface and will not work when the server is down.
The intention is to keep to repo root clean while the list of packages
is slowly growing.
Additionally, a bunch of small (~30 LoC) files in the repo root is
merged into a single maddy.go file, for the same reason.
Most of the internal code is moved into the internal/ directory. Go
toolchain will make it impossible to import these packages from external
applications.
Some packages are renamed and moved into the pkg/ directory in the root.
According to https://github.com/golang-standards/project-layout this is
the de-facto standard to place "library code that's ok to use by
external applications" in.
To clearly define the purpose of top-level directories, README.md files
are added to each.
While using maddyctl with non-standard directories, users always have to
specify them using command-line arguments, which is inconvenient. This
commit allows maddyctl to read these values from the configuration,
requiring only the path to the configuration file to be specified.
To ensure consistency and avoid confusion, paths specified in
the configuration are required to be absolute.
Due to inability to set MADDYSTATE, MADDYRUNTIME, etc before reading the
configuration, these environment variables were removed.
Some fixed warnings are not actual problems. I just want output
golangci-run to be smaller. Otherwise it is problematic to see
actual problems found by linters due to amount of noise.
testutils, ctl/maddyctl: Remove quite a lot of unused entities.
msgpipeline: Fix typo in log message.
msgpipeline: Add missing 'case 0' for 'reject' directive parsing
msgpipeline: Preallocate slice in parseChecksGroup
Check errors in some places in tests.
smtp_upstream: Move DATA command use into Commit
target/queue: Avoid copying sync.Mutex
Not a problem since it is not used after copying, but I just want
govet to shut up.
In particular, allow to set Version constant for use when module build
info is not available (executable is built using 'go build' instead
of 'go get').
Now it is not tied go-imap-sql details (with the exception of special
features), allowing it to be used with other storage backends that will
be added in the future.
--unsafe flag is removed and now maddyctl explicitly asks for
confirmation in cases where transaction may be unsafe for connected
clients. --yes flag disables that. In the future, maddy can be
extended with IPC interface to push updates so it this restriction
can be lifted altogether.
1. There is only one version for maddy and imapsql-ctl utility.
This prevents confusion about compatibility.
2. Modified imapsql-ctl understands maddy config format, this allows
it to read needed values from it without the need for lengthy commmand
line arguments.
Closes#148.
Most previously existing ways to specify Config/State/Libexec
directories are removed. Now they can be set only using
command line flags. Generally, having multiple ways to set these
values can be confusing and also believed to be unnecessary.
All relative paths in the configuration are now interpreted
relatively to the State directory.
Additionally, new value is added: Runtime directory. It will used
in the future for temporary files.
All directories that should be writable will be created on startup
if possible and checked for writebility.
Allows faster and simpler implementation for cases when maddy
is running as a privileged user.
Automatic fallback to helper binary is not implemented since otherwise
config directive 'use_helper no' would make less sense and config.Map
does not support "enums" (true/false/not-specified) yet.
Closes#127.
Root package now contains only initialization code and 'dummy' module.
Each module now got its own package. Module packages are grouped by
their main purpose (storage/, target/, auth/, etc). Shared code is
placed in these "group" packages.
Parser for module references in config is moved into config/module.
Code shared by tests (mock modules, etc) is placed in testutils.
This is a very useful tool for performance analysis, having it as hand
without the need to always modify the source code to enable it is simply
convenient.
Also now we can ask users to use it when reporting performance bugs.
Unexport shadow.SecsInDay
Add -Wall -Werror -Wpedantic to CFLAGS in main.go.
run() => run(void).
Check for getline's buffer length.
Check for NULL returned from malloc.
All configuration directives now use underscores instead of dashes for
consistency with Caddy conventions.
Disallow defining multiple module instances with implicit name.
Remove global module.WaitGroup and add as field where it is necessary
(endpoint modules).
buf.Reset() and use rewind Reader in SMTP pipeline.
Rename several entities in code (NewModule => FuncNewModule, CfgTreeNode
=> Node, etc).
Also fix several warnings from linters.