Skip to main content

feder_runtime_server/
config.rs

1// Feder: A portable ActivityPub core for many runtimes.
2// Copyright (C) 2026 Feder contributors
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as published by
6// the Free Software Foundation, version 3.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16use std::net::SocketAddr;
17
18use feder_vocab::Iri;
19
20pub struct RuntimeConfig {
21    pub bind: SocketAddr,
22    pub actor_id: Iri,
23    pub inbox: Iri,
24    pub outbox: Iri,
25    pub username: String,
26    pub preferred_username: String,
27    pub handle_host: String,
28    // TODO(#25): Replace this seeded preview note with durable runtime storage.
29    pub note_id: Iri,
30}
31
32impl RuntimeConfig {
33    pub fn default_local() -> Self {
34        Self {
35            actor_id: "http://127.0.0.1:3000/users/alice"
36                .parse()
37                .expect("valid default actor IRI"),
38            inbox: "http://127.0.0.1:3000/users/alice/inbox"
39                .parse()
40                .expect("valid default inbox IRI"),
41            outbox: "http://127.0.0.1:3000/users/alice/outbox"
42                .parse()
43                .expect("valid default outbox IRI"),
44            bind: "127.0.0.1:3000"
45                .parse()
46                .expect("valid default bind address"),
47            username: "alice".to_string(),
48            preferred_username: "alice".to_string(),
49            handle_host: "127.0.0.1:3000".to_string(),
50            // TODO(#25): Replace this seeded preview note with durable runtime storage.
51            note_id: "http://127.0.0.1:3000/notes/1"
52                .parse()
53                .expect("valid default note IRI"),
54        }
55    }
56}