22 lines
1.6 KiB
Markdown
22 lines
1.6 KiB
Markdown
|
|
# Startup and configuration for c_nostr_relay
|
|
|
|
No command line variables. Quick start.
|
|
|
|
## First time startup
|
|
When the program first starts, it generates a new private and public keys for the program, and for the admin. In the command line it prints out the private key for the admin. It creates a database in the same directory as the application. It names the database after the pubkey of the database <pubkey>.nrdb (This stands for nostr relay db)
|
|
|
|
Internally, it creates a valid nostr event using the generated admin private key, and saves it to the events table in the db. That nostr configuration event is a type 33334 event, with a d tag that equals the database public key d=<db pubkey>.
|
|
|
|
The event is populated from internal default values. Then the configuration setup is run by reading the event from the database events table.
|
|
|
|
Important, the constant values are ALWAYS read and set from the 33334 event in the events table, they are NEVER read from the stored default values. This is important for consistancy.
|
|
|
|
The config section of the program keeps track of the admin file, and if it ever changes, it does what is needed to implement the change.
|
|
|
|
|
|
## Later startups
|
|
The program looks for the database with the name c_nostr_relay.db in the same directory as the program. If it doesn't find it, it assumes a first time startup. If it does find it, it loads the database, and the config section reads the config event and proceedes from there.
|
|
|
|
## Changing database location?
|
|
Changing the location of the databases can be done by creating a sym-link to the new location of the database. |