@@ -11,12 +11,13 @@ import (
11
11
)
12
12
13
13
// Function to set up the relay service
14
- func SetupRelayService (domain , relaySecretKey , relayContact string ) {
14
+ func SetupRelayService (domain , pubKey , relaySecretKey , relayContact string ) {
15
15
spinner , _ := pterm .DefaultSpinner .Start ("Configuring relay service..." )
16
16
17
17
// Ensure the data directory exists and set permissions
18
18
spinner .UpdateText ("Creating data directory..." )
19
19
directories .CreateDirectory (DataDirPath , 0755 )
20
+ directories .CreateDirectory (fmt .Sprintf ("%s/%s" , DataDirPath , relays .DBDir ), 0755 )
20
21
21
22
// Use chown command to set ownership of the data directory to the nostr user
22
23
directories .SetOwnerAndGroup (relays .User , relays .User , DataDirPath )
@@ -38,16 +39,22 @@ func SetupRelayService(domain, relaySecretKey, relayContact string) {
38
39
files .RemoveFile (ServiceFilePath )
39
40
40
41
// Construct the sed command to change the db path
41
- files .InPlaceEdit (fmt .Sprintf (`s|db = ".*"|db = "%s"|` , DataDirPath ), TmpConfigFilePath )
42
+ files .InPlaceEdit (fmt .Sprintf (`s|db = ".*"|db = "%s/%s "|` , DataDirPath , relays . DBDir ), TmpConfigFilePath )
42
43
43
44
// TODO
44
45
// Determine system hard limit
45
46
// Determine preferred nofiles value
46
47
// Construct the sed command to change the nofiles limit
47
48
49
+ // Construct the sed command to change the realIpHeader
50
+ files .InPlaceEdit (`s|realIpHeader = .*|realIpHeader = "x-forwarded-for"|` , TmpConfigFilePath )
51
+
48
52
// Construct the sed command to change the info description
49
53
files .InPlaceEdit (fmt .Sprintf (`s|description = ".*"|description = "%s"|` , ConfigFileInfoDescription ), TmpConfigFilePath )
50
54
55
+ // Construct the sed command to change the pubkey
56
+ files .InPlaceEdit (fmt .Sprintf (`s|pubkey = .*|pubkey = "%s"|` , pubKey ), TmpConfigFilePath )
57
+
51
58
// Construct the sed command to change the contact
52
59
files .InPlaceEdit (fmt .Sprintf (`s|contact = ".*"|contact = "%s"|` , relayContact ), TmpConfigFilePath )
53
60
0 commit comments