node: Simplify configuration

This is a change to the `config.json` file which removes certain options
that are best not touched and changes some options to make them easier
to work with.

1. We change the default journaling mode to "wal" and remove the config
   option.
2. We remove the option to set the peer connection "target", as it's not
   a good idea to set this to a different value, as it affects the
   network.
3. We combine seeding policy & scope, since there's no need to set the
   scope when the policy is "block". In that case, we always want to
   block "all" remotes. The new policy configuration has the following
   schema:

   { seedingPolicy: { default: "block" | "allow", scope?: "all" | "followed" } }

   The "scope" key is not used when "default" is set to "block".

4. We add an `extra` field to the node config for options that are not
   recognized. We use this to warn the user.
This commit is contained in:
Alexis Sellier
2024-06-04 14:08:15 +02:00
committed by cloudhead
parent d4a69b433c
commit bee6c4568f
2 changed files with 11 additions and 16 deletions
+7 -9
View File
@@ -8,7 +8,10 @@ use serde_json::json;
use radicle::identity::RepoId;
use radicle::node::routing::Store;
use radicle::node::{policy, AliasStore, Handle, NodeId, DEFAULT_TIMEOUT};
use radicle::node::{
policy::{Policy, SeedPolicy},
AliasStore, Handle, NodeId, DEFAULT_TIMEOUT,
};
use radicle::Node;
use crate::api::error::Error;
@@ -84,16 +87,11 @@ async fn node_policies_repos_handler(State(ctx): State<Context>) -> impl IntoRes
let policies = ctx.profile.policies()?;
let mut repos = Vec::new();
for policy::SeedPolicy {
rid: id,
scope,
policy,
} in policies.seed_policies()?
{
for SeedPolicy { rid: id, policy } in policies.seed_policies()? {
repos.push(json!({
"id": id,
"scope": scope,
"policy": policy,
"scope": policy.scope().unwrap_or_default(),
"policy": Policy::from(policy),
}));
}
+4 -7
View File
@@ -83,13 +83,9 @@ mod routes {
"node": {
"alias": "seed",
"listen": [],
"peers": {
"type": "dynamic",
"target": 8
},
"peers": { "type": "dynamic" },
"connect": [],
"externalAddresses": [],
"db": { "journalMode": "rollback" },
"network": "main",
"log": "INFO",
"relay": "auto",
@@ -115,8 +111,9 @@ mod routes {
}
},
"workers": 8,
"policy": "block",
"scope": "all"
"seedingPolicy": {
"default": "block",
}
}
},
"home": seed.profile.path()