Ktra 🚚

Your Little Cargo Registry.

Ktra is an implementation of the Alternate Registry that is introduced for non-public crates in Rust/Cargo 1.34.

In other words, Ktra is an all-in-one package of the private cargo registry.

Features

Current

Planned

And any feature requests are welcome!

Install

bash $ cargo install ktra

Quick Start

  1. Create the index git repository.
  2. Put a file named config.json and commit then push it to remote repository.

bash $ echo '{"dl":"http://localhost:8000/dl","api":"http://localhost:8000"}' > config.json $ git add config.json $ git commit -am "initial commit" $ git push origin main

  1. Edit your .cargo/config.toml

toml [registries] ktra = { index = "https://github.com/moriturus/ktra-index.git" }

  1. Create a configuration file.

```toml

essential configurations are remote_url and credential informations.

if you use HTTPS protocol, please specify https_username and https_password fields.

using SSH protocol, ssh_privkey_path should be specified.

[indexconfig] remoteurl = "https://github.com/moriturus/ktra-index.git" httpsusername = "moriturus" httpspassword = "2mdzctfryqirlqbhys43xsc46rbnr93g"

sshprivkeypath = "/path/to/your/private_key"

name = "committer/author name"

email = "robot@example.com"

below configurations are optional.

[db_config]

dbpath = "mydb"

[cratefilesconfig]

dldirpath = "./crates"

dl_path = ["download", "path", "to", "mount"]

[server_config]

address = "127.0.0.1"

port = 8080

```

  1. Run ktra

bash $ ktra -c /path/to/config.toml

  1. Create user and login

bash $ curl -X POST http://localhost:8000/ktra/api/v1/new_user/alice {"token":"0N9mgZb3kzxtgGKECFuMkM2RT5xkYhdY"} $ cargo login --registry=ktra 0N9mgZb3kzxtgGKECFuMkM2RT5xkYhdY Login token for `ktra` saved

  1. Publish your crate.

```bash $ cat Cargo.toml [package] name = "my_crate" version = "0.1.0" authors = ["moriturus moriturus@alimensir.com"] edition = "2018" description = "sample crate"

[dependencies] serde = "1.0"

$ cargo publish --registry=ktra ```

  1. Use your crate from another crate.

```toml [package] name = "myanothercrate" version = "0.1.0" authors = ["moriturus moriturus@alimensir.com"] edition = "2018"

[dependencies] my_crate = { version = "0.1", registry = "ktra" } ```

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.