mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-08-29 06:16:05 +00:00
add env variables to ignore download of attachments and stories in json-rpc mode
see #723
This commit is contained in:
parent
4102331404
commit
8834570421
@ -150,3 +150,6 @@ There are a bunch of environmental variables that can be set inside the docker c
|
||||
* `DEFAULT_SIGNAL_TEXT_MODE`: Allows to set the default text mode that should be used when sending a message (supported values: `normal`, `styled`). The setting is only used in case the `text_mode` is not explicitly set in the payload of the `send` method.
|
||||
|
||||
* `LOG_LEVEL`: Allows to set the log level. Supported values: `debug`, `info`, `warn`, `error`. If nothing is specified, it defaults to `info`.
|
||||
|
||||
* `JSON_RPC_IGNORE_ATTACHMENTS`: When set to `true`, attachments are not automatically downloaded in json-rpc mode (default: `false`)
|
||||
* `JSON_RPC_IGNORE_STORIES`: When set to `true`, stories are not automatically downloaded in json-rpc mode (default: `false`)
|
||||
|
||||
@ -13,7 +13,7 @@ import (
|
||||
const supervisorctlConfigTemplate = `
|
||||
[program:%s]
|
||||
process_name=%s
|
||||
command=bash -c "nc -l -p %d <%s | signal-cli --output=json --config %s jsonRpc >%s"
|
||||
command=bash -c "nc -l -p %d <%s | signal-cli --output=json --config %s jsonRpc%s%s >%s"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=10
|
||||
@ -58,6 +58,18 @@ func main() {
|
||||
log.Fatal("Couldn't change permissions of fifo with name ", fifoPathname, ": ", err.Error())
|
||||
}
|
||||
|
||||
signalCliIgnoreAttachments := ""
|
||||
ignoreAttachments := utils.GetEnv("JSON_RPC_IGNORE_ATTACHMENTS", "")
|
||||
if ignoreAttachments == "true" {
|
||||
signalCliIgnoreAttachments = " --ignore-attachments"
|
||||
}
|
||||
|
||||
signalCliIgnoreStories := ""
|
||||
ignoreStories := utils.GetEnv("JSON_RPC_IGNORE_STORIES", "")
|
||||
if ignoreStories == "true" {
|
||||
signalCliIgnoreStories = " --ignore-stories"
|
||||
}
|
||||
|
||||
supervisorctlProgramName := "signal-cli-json-rpc-1"
|
||||
supervisorctlLogFolder := "/var/log/" + supervisorctlProgramName
|
||||
_, err = exec.Command("mkdir", "-p", supervisorctlLogFolder).Output()
|
||||
@ -72,7 +84,8 @@ func main() {
|
||||
|
||||
|
||||
supervisorctlConfig := fmt.Sprintf(supervisorctlConfigTemplate, supervisorctlProgramName, supervisorctlProgramName,
|
||||
tcpPort, fifoPathname, signalCliConfigDir, fifoPathname, supervisorctlProgramName, supervisorctlProgramName)
|
||||
tcpPort, fifoPathname, signalCliConfigDir, signalCliIgnoreAttachments, signalCliIgnoreStories, fifoPathname,
|
||||
supervisorctlProgramName, supervisorctlProgramName)
|
||||
|
||||
|
||||
err = ioutil.WriteFile(supervisorctlConfigFilename, []byte(supervisorctlConfig), 0644)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user