Closed brandon1024 closed 5 months ago
Hi!
The error says unhandled file type
which is done "on purpose" I would say.
Actually, you cannot use the application on directory that have other files than the ATAC ones (config atac.toml
, log atac.log
and collections my_collection.json
).
TL;DR: Start with an empty directory and then it will be "atac-only".
If you think this was a bad idea, it can change without problem :)
Merci également
In that case, perhaps a better error message would help. Additionally it's not stated anywhere in the documentation the requirements for this directory.
I'll be honest, I do find this behaviour a bit strange (and concerning). Correct me if I'm wrong, but I get the impression that atac
reads everything in the config directory at startup to configure itself. I worry a bit about this; reading and parsing arbitrary files can be potentially unsafe.
I won't push the issue further though :-) It's your call if you'd like to keep existing behaviour or make changes, I'm only trying to help!
If it were me, I would organize atac.toml
such that paths to atac.log
and collections are defined there, and only those files listed there are read at startup, instead of the current behaviour of reading everything in that directory.
[core]
log-path = "atac.log"
[collections]
my_collection = "my_collection.json"
This has the added benefit that you can separate configuration from runtime files: it's pretty common to see applications use configuration files in the user's $HOME
directory or $XDG_CONFIG_HOME
, with runtime files and other configuration files located in $XDG_DATA_HOME
/$XDG_CONFIG_HOME
.
If users could put atac.toml
in their home directory, the command line option --directory <dir>
would be no longer strictly necessary.
I digress :sweat_smile:
In that case, perhaps a better error message would help. Additionally it's not stated anywhere in the documentation the requirements for this directory.
I'll be honest, I do find this behaviour a bit strange (and concerning). Correct me if I'm wrong, but I get the impression that
atac
reads everything in the config directory at startup to configure itself. I worry a bit about this; reading and parsing arbitrary files can be potentially unsafe.I won't push the issue further though :-) It's your call if you'd like to keep existing behaviour or make changes, I'm only trying to help!
It may seem unclear until you read the code, the application is not parsing anything that is not handleable. So no worries about that. I removed the panic
when comming to a non-handleable file, it will just ignore it.
Additional Thoughts
If it were me, I would organize
atac.toml
such that paths toatac.log
and collections are defined there, and only those files listed there are read at startup, instead of the current behaviour of reading everything in that directory.[core] log-path = "atac.log" [collections] my_collection = "my_collection.json"
This has the added benefit that you can separate configuration from runtime files: it's pretty common to see applications use configuration files in the user's
$HOME
directory or$XDG_CONFIG_HOME
, with runtime files and other configuration files located in$XDG_DATA_HOME
/$XDG_CONFIG_HOME
.If users could put
atac.toml
in their home directory, the command line option--directory <dir>
would be no longer strictly necessary.
Yes it is planned that the config file (atac.toml
) will host more of those things (e.g. log file path). However, listing the collections in the config file is not part of the main philosophy. But I'll keep that in mind, it's an interesting point of view.
Issue Description
When specifying a tmpfs location as an argument to
--directory
, the application panics unexpectedly.I haven't dug any deeper. It should be easily reproducible.
Looks like it should be a quick fix. Cool project! :-)
Merci!