mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-03-14 02:40:14 +00:00
removed fifo pathname from json-rpc config
* not needed anymore
This commit is contained in:
parent
877bc9e845
commit
4fb1be6657
@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
@ -41,23 +40,8 @@ func main() {
|
||||
jsonRpc2ClientConfig := utils.NewJsonRpc2ClientConfig()
|
||||
|
||||
var tcpPort int64 = 6001
|
||||
fifoPathname := "/tmp/sigsocket1"
|
||||
|
||||
jsonRpc2ClientConfig.AddEntry(utils.MULTI_ACCOUNT_NUMBER, utils.JsonRpc2ClientConfigEntry{TcpPort: tcpPort, FifoPathname: fifoPathname})
|
||||
|
||||
os.Remove(fifoPathname) //remove any existing named pipe
|
||||
|
||||
_, err := exec.Command("mkfifo", fifoPathname).Output()
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create fifo with name ", fifoPathname, ": ", err.Error())
|
||||
}
|
||||
|
||||
uid := utils.GetEnv("SIGNAL_CLI_UID", "1000")
|
||||
gid := utils.GetEnv("SIGNAL_CLI_GID", "1000")
|
||||
_, err = exec.Command("chown", uid+":"+gid, fifoPathname).Output()
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't change permissions of fifo with name ", fifoPathname, ": ", err.Error())
|
||||
}
|
||||
jsonRpc2ClientConfig.AddEntry(utils.MULTI_ACCOUNT_NUMBER, utils.JsonRpc2ClientConfigEntry{TcpPort: tcpPort})
|
||||
|
||||
signalCliIgnoreAttachments := ""
|
||||
ignoreAttachments := utils.GetEnv("JSON_RPC_IGNORE_ATTACHMENTS", "")
|
||||
@ -73,7 +57,7 @@ func main() {
|
||||
|
||||
supervisorctlProgramName := "signal-cli-json-rpc-1"
|
||||
supervisorctlLogFolder := "/var/log/" + supervisorctlProgramName
|
||||
_, err = exec.Command("mkdir", "-p", supervisorctlLogFolder).Output()
|
||||
_, err := exec.Command("mkdir", "-p", supervisorctlLogFolder).Output()
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create log folder ", supervisorctlLogFolder, ": ", err.Error())
|
||||
}
|
||||
|
||||
@ -2,15 +2,15 @@ package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
const MULTI_ACCOUNT_NUMBER string = "<multi-account>"
|
||||
|
||||
type JsonRpc2ClientConfigEntry struct {
|
||||
TcpPort int64 `yaml:"tcp_port"`
|
||||
FifoPathname string `yaml:"fifo_pathname"`
|
||||
TcpPort int64 `yaml:"tcp_port"`
|
||||
}
|
||||
|
||||
type JsonRpc2ClientConfigEntries struct {
|
||||
@ -47,14 +47,6 @@ func (c *JsonRpc2ClientConfig) GetTcpPortForNumber(number string) (int64, error)
|
||||
return 0, errors.New("Number " + number + " not found in local map")
|
||||
}
|
||||
|
||||
func (c *JsonRpc2ClientConfig) GetFifoPathnameForNumber(number string) (string, error) {
|
||||
if val, ok := c.config.Entries[number]; ok {
|
||||
return val.FifoPathname, nil
|
||||
}
|
||||
|
||||
return "", errors.New("Number " + number + " not found in local map")
|
||||
}
|
||||
|
||||
func (c *JsonRpc2ClientConfig) GetTcpPortsForNumbers() map[string]int64 {
|
||||
mapping := make(map[string]int64)
|
||||
for number, val := range c.config.Entries {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user