LemonCore. Paths
(lemon_core v0.1.0)
View Source
Filesystem layout used by lemon_core.
Everything the library reads or writes by convention hangs off two
directories: a per-user state directory (~/.lemon) and a per-project one
(<project>/.lemon). Both are configurable, and the defaults are the
reference runtime's layout, so an application embedding lemon_core can put
its state somewhere that is not named after Lemon:
config :lemon_core, :paths,
state_dir: ".myapp",
config_file: "config.toml"Individual locations can also be pinned outright, which wins over the composed default:
config :lemon_core, :paths,
home_state_dir: "/var/lib/myapp",
global_config: "/etc/myapp/config.toml"Every function also accepts the same keys as options, which is how callers (and tests) scope a lookup to a temporary home without touching app env.
Not covered here
The secrets master key file has its own :key_file setting — see
LemonCore.Secrets.KeyProvider, which resolves ~ against a caller-supplied
home so that a scoped HOME cannot leak into the real key file.
Summary
Functions
Directory holding filesystem-rollback checkpoints.
Name of the config file inside a state directory, config.toml by default.
Global config file, ~/.lemon/config.toml by default.
The user's home directory: the :home_dir option, then $HOME.
A path inside the per-user state directory.
Per-user state directory, ~/.lemon by default.
Project config file for cwd, <cwd>/.lemon/config.toml by default.
A path inside a project's state directory.
Per-project state directory, <cwd>/.lemon by default.
Name of the state directory, .lemon by default.
Types
@type opts() :: keyword()
Functions
Directory holding filesystem-rollback checkpoints.
Deliberately under the system temp directory rather than the state directory:
checkpoints are short-lived rollback material for an in-flight session, and
losing them on reboot is the intended behaviour. Hosts that want them to
survive can point :checkpoint_dir at a durable location.
Resolved per call — a module attribute here would freeze the build machine's temp directory into a release.
iex> LemonCore.Paths.checkpoint_dir(checkpoint_dir: "/srv/checkpoints")
"/srv/checkpoints"
Name of the config file inside a state directory, config.toml by default.
Global config file, ~/.lemon/config.toml by default.
The user's home directory: the :home_dir option, then $HOME.
A path inside the per-user state directory.
iex> LemonCore.Paths.home_path(["store"], home_dir: "/home/x")
"/home/x/.lemon/store"
Per-user state directory, ~/.lemon by default.
Project config file for cwd, <cwd>/.lemon/config.toml by default.
A path inside a project's state directory.
iex> LemonCore.Paths.project_path("/srv/app", ["proofs"])
"/srv/app/.lemon/proofs"
Per-project state directory, <cwd>/.lemon by default.
Name of the state directory, .lemon by default.