If XDG_RUNTIME_DIR is set, put the socket file there.
If not, default to storing it in our data dir. We cannot default to a
path such as /run/user/$UID/ because it does not exist on all systems.
Any system running systemd will set this var by default, and ensure that
the directory it points to is correctly setup.
* chore(build): compile protobufs with protox
protox is a pure-rust implementation of the protobuf compiler.
Therefore, it can be managed by cargo.
This removes the implicit dependency on protoc being available
in the environment for the build.
* fix(build): replace copypasta in build script
The paths passed to `compile` aren't actually used by the build.
`skip_protoc_run` prevents that.
That's why a clean build succeeds even with this mistake.
However, the paths are passed to a `cargo:rerun-if-changed` directive.
So this mistake would've caused a failed incremental build if the
protobuf definitions were changed.
For Atuin Cloud, we rate limit login attempts (and a few other endpoints). Ensure that the user gets a descriptive response
For self hosted users, if you wish to rate limit, I'd suggest
configuring this with your reverse proxy.
This avoids issues with clients attempting to connect to the daemon
while it's starting, systemd creates the socket early and will queue
connections up until the daemon is ready to accept them.
The client commands would open sqlite, even if not 100% required
Remove this for
1. history start/end
2. shell init
Init seems to be around 2ms faster on my system, with this change.
* fix(daemon): do not try to sync if logged out
I've also added Settings::logged_in, as there are a few places where we
switch on login state.
* make session_token a function
Previously, in the event that there was a configuration issue and the
atuin server failed to connect to PostgreSQL, it would log the password.
For example, if the password authentication failed the following log
message would be printed:
Error: failed to connect to db: PostgresSettings { db_uri:
"postgres://atuin:definitelymypassword@db.example.com/atuin" }
This change sets the password to "****" when printing it via Debug:
Error: failed to connect to db: PostgresSettings { db_uri:
"postgres://atuin:****@db.example.com/atuin" }
Hopefully few people use **** as the actual password.
* fix: gracefully exit on windows
* feat(daemon): tcp support for windows
* feat(daemon): add tcp port configuration
* fix: logging and fix compiler error
* docs: add build dependency to the readme
fix(docs): move a line up
* fix: missing field error
* docs: adds the daemon section to the default config
* fix: clippy and fmt
* feat: Update README.md
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
* refactor: changes tcp port and other stuff as per request
* fix(config): update default tcp port in example config
* fix: complier error on unix
* refactor: make the cfg stuff look better
---------
Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
* init daemon crate
* wip
* minimal functioning daemon, needs cleanup for sure
* better errors
* add signal cleanup
* logging
* things
* add sync worker
* move daemon crate
* 30s -> 5mins
* make clippy happy
* fix stuff maybe?
* fmt
* trim packages
* rate limit fix
* more protoc huh
* this makes no sense, why linux why
* can it install literally just curl
* windows in ci is slow, and all the newer things will not work there. disable the daemon feature and it will build
* add daemon feature
* maybe this
* ok wut where is protoc
* try setting protoc
* hm
* try copying protoc
* remove optional
* add cross config
* idk nix
* does nix want this?
* some random pkg I found does this
* uh oh
* hack, be gone!
* update contributing
* fix(dotfiles): allow clearing aliases, disable import
At the moment there are far too many edge cases to handle importing
aliases.
1. We need an interactive shell to print aliases. Without it, most
shells won't report much.
2. Many people have their shells print things on startup (graphics,
fortunes, etc). This could be detected as an attempt to set an alias.
Rather than spend the next year finding import edge cases, I'm
disabling it for now. There's probably a better way we can do this?
* clippy
* feat(history): create atuin-history, add stats to it
I'd like to eventually pull all the history stuff into this crate. Stats
are a nice start, as I'd like to use them from the UI anyways.
* lock
* clippy
P99 is usually <100ms which is excellent, but occasionally has big
spikes to 1000ms. This is only on the record index.
I don't want this to get out of hand. I've ran a few test queries and
they all complete very fast, and are purely index scans.
Hopefully this helps figure out if it's a specific user with tonnes of
stores or something? Otherwise there could be something up with my db.
I should probably also figure out some proper log levels or tracing lol.
There's a bunch of duplication here!
I'd also like to support syncing shell "snippets", aka just bits of
shell config that don't fit into the structure here. Potentially special
handling for PATH too.
Rather than come up with some abstraction in the beginning, which
inevitably will not fit future uses, I'm duplicating code _for now_.
Once all the functionality is there, I can tidy things up and sort a
proper abstraction out.
Something in atuin-client for map/list style synced structures would
probably work best.