Make the lnk-home argument optional so that by default lnk-gitd uses
the `LnkHome::ProjectDirs`.
Signed-off-by: Alex Good <alex@memoryandthought.me>
---
cli/gitd-lib/src/args.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cli/gitd-lib/src/args.rs b/cli/gitd-lib/src/args.rs
index 705debb0..2ec4d966 100644
--- a/cli/gitd-lib/src/args.rs+++ b/cli/gitd-lib/src/args.rs
@@ -19,8 +19,8 @@ use crate::{
#[derive(Debug, Parser)]
pub struct Args {
- /// The path to use `LNK_HOME`.- pub lnk_home: PathBuf,+ /// The path to use as `LNK_HOME`, if not set defaults to ProjectDirs.+ pub lnk_home: Option<PathBuf>, #[clap(short)]
/// The socket address to start the gitd server on.
pub addr: Option<SocketAddr>,
@@ -61,7 +61,7 @@ impl Args {
self,
spawner: Arc<link_async::Spawner>,
) -> Result<Config<BoxedSigner>, Error> {
- let home = LnkHome::Root(self.lnk_home);+ let home = self.lnk_home.map(LnkHome::Root).unwrap_or(LnkHome::ProjectDirs); let profile = Profile::from_home(&home, None)?;
let signer = spawner
.blocking({
--
2.36.1
Add some very simple example unit files and a README explaining how to
use them.
Signed-off-by: Alex Good <alex@memoryandthought.me>
---
bins/example-systemd-config/README.md | 68 ++++++++++++++++++++bins/example-systemd-config/lnk-gitd.service | 6 ++bins/example-systemd-config/lnk-gitd.socket | 6 ++
3 files changed, 80 insertions(+)
create mode 100644 bins/example-systemd-config/README.md
create mode 100644 bins/example-systemd-config/lnk-gitd.service
create mode 100644 bins/example-systemd-config/lnk-gitd.socket
diff --git a/bins/example-systemd-config/README.md b/bins/example-systemd-config/README.md
new file mode 100644
index 00000000..e16f34a6
--- /dev/null
@@ -0,0 +1,68 @@
+Here's how to get a simple lnk setup up and running on linux using systemd.++## Build and install the CLI tools++```+cd bins+cargo install --path lnk-gitd+cargo install --path lnk+```++## Setup your local identity++```+# create a profile+lnk profile create+# create your person identity, record the `urn` field of the resulting JSON+lnk identities person create --payload '{"name": "<your display name>"}'+lnk identities local set --urn <the urn from above>+```++## Add your seeds++Modify `$XDG_CONFIG_DIR/.radicle-link/<profile ID>/seeds`, add the following+line:++```+<your seed peer ID>@<address>:<port>+```++Note that the active profile can be found with `lnk profile get`+++## Create the unit files++Copy `example-systemd-config/lnk-gitd.service` to `$XDG_CONFIG_DIR/user`. Modify+it so that the `<your lnk-gitd>` points at the location of the `lnk-gitd` you+installed above (probably `$HOME/.cargo/bin/lnk-gitd`).++Copy `example-systemd-config/lnk-gitd.socket` to `$XDG_CONFIG_DIR/user`, modify+the port in `ListenStream` to be wherever you want the git server to run.++Finally, enable the socket with `systemctl --user enable lnk-gitd.socket`+++## Clone a project and mess around and add remote config++```+lnk clone --urn <some project>+cd <project name>+```++You'll need to update the project config to point `rad://` urls at `lnk-gitd`.+Put the following lines in `.git/config`++```+[url "ssh://127.0.0.1:9987/rad:git:"]+ insteadOf = "rad://"+```++Note that you can't currently put this in `~/.gitconfig` as it messes up `lnk+clone`.+++## Off you go++Now you can push and pull from your monorepo via `git push rad`. Currently you+will need to add remotes for each other peer you want to work, this will be+fixed once we have updated `lnk sync` to update include files.
diff --git a/bins/example-systemd-config/lnk-gitd.service b/bins/example-systemd-config/lnk-gitd.service
new file mode 100644
index 00000000..eb9999ec
--- /dev/null
@@ -0,0 +1,6 @@
+[Unit]+Description=lnk git daemon++[Service]+ExecStart=<your lnk-gitd> --linger-timeout 10000 --push-seeds --fetch-seeds+Environment=RUST_LOG=info
diff --git a/bins/example-systemd-config/lnk-gitd.socket b/bins/example-systemd-config/lnk-gitd.socket
new file mode 100644
index 00000000..dca23f54
--- /dev/null
@@ -0,0 +1,6 @@
+[Socket]+ListenStream=127.0.0.1:9987+FileDescriptorName=ssh++[Install]+WantedBy=sockets.target
--
2.36.1