Compare commits

...

3 commits

3 changed files with 19 additions and 2 deletions

View file

@ -73,8 +73,9 @@ variable.
**** Extra remote configuration
=lohr= looks for a =lohr-config.yaml= file in its =LOHR_HOME= directory. This
file takes the following format:
=lohr= looks for a =lohr-config.yaml= file in its =LOHR_HOME= directory. The
=LOHR_CONFIG= variable takes precedence over looking into the state directory.
This file takes the following format:
#+begin_src yaml
default_remotes:
@ -83,12 +84,18 @@ default_remotes:
additional_remotes:
- "git@git.sr.ht:~user"
blacklist:
- "private-.*"
#+end_src
- ~default_remotes~ is a list of remotes to use if no ~.lohr~ file is found in a
repository.
- ~additional_remotes~ is a list of remotes to add in any case, whether the
original set of remotes is set via ~default_remotes~ or via a =.lohr= file.
- ~blacklist~ is a list of regular expressions to match against the full
repository names. Any that matches will not be mirrored, even if it contains a
`.lohr` file.
Both settings take as input a list of "stems", i.e. incomplete remote addresses,
to which the repo's name will be appended (so for example, if my

View file

@ -37,6 +37,13 @@
defaultPackage = naersk-lib.buildPackage {
src = ./.;
pname = "lohr";
meta = with pkgs.lib; {
description = "A Git mirroring tool";
homepage = "https://github.com/alarsyo/lohr";
license = with licenses; [ mit asl20 ];
platforms = platforms.unix;
};
};
defaultApp = flake-utils.lib.mkApp {

View file

@ -52,6 +52,9 @@ fn repo_updater(rx: Receiver<Job>, homedir: PathBuf, config: GlobalSettings) {
fn parse_config(mut path: PathBuf) -> anyhow::Result<GlobalSettings> {
path.push("lohr-config");
path.set_extension("yaml");
let path = env::var("LOHR_CONFIG")
.map(Into::into)
.unwrap_or_else(|_| path);
let config = if let Ok(file) = File::open(path.as_path()) {
serde_yaml::from_reader(file)?
} else {