Skip to content

Commit 48e9e38

Browse files
Update README.md
1 parent a6cee99 commit 48e9e38

File tree

1 file changed

+65
-60
lines changed

1 file changed

+65
-60
lines changed

README.md

Lines changed: 65 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -190,34 +190,39 @@ networks:
190190
Create a `nginx.conf` file in the `docker-compose.yaml` folder and mount it to `etc/nginx/conf.d/default.conf`:
191191

192192
```conf
193-
server {
194-
# Allow SSL on Port 443
195-
listen 443 ssl;
196-
197-
# Add allowed hostnames which nginx should respond to
198-
# `_` for any
199-
server_name localhost;
200-
201-
ssl_certificate /etc/nginx/ssl/cert.crt;
202-
ssl_certificate_key /etc/nginx/ssl/cert.key;
203-
204-
location / {
205-
# Use whatever network alias you set in the docker-compose file
206-
proxy_pass http://secured-signal-api:8880;
207-
proxy_set_header Host $host;
208-
proxy_set_header X-Real-IP $remote_addr;
209-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
210-
proxy_set_header X-Forwarded-Host $host;
211-
proxy_set_header X-Fowarded-Proto $scheme;
212-
}
213-
}
193+
services:
194+
secured-signal:
195+
image: ghcr.io/codeshelldev/secured-signal-api:latest
196+
container_name: secured-signal-api
197+
environment:
198+
API__URL: http://signal-api:8080
199+
SETTINGS__VARIABLES__RECIPIENTS: "[+123400002,+123400003,+123400004]"
200+
SETTINGS__VARIABLES__NUMBER: "+123400001"
201+
API__TOKENS: "[LOOOOOONG_STRING]"
202+
restart: unless-stopped
203+
networks:
204+
backend:
205+
aliases:
206+
- secured-signal-api
214207
215-
# Redirect HTTP to HTTPs
216-
server {
217-
listen 80;
218-
server_name localhost;
219-
return 301 https://$host$request_uri;
220-
}
208+
nginx:
209+
image: nginx:latest
210+
container_name: secured-signal-proxy
211+
volumes:
212+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
213+
# Load SSL certificates: cert.key, cert.crt
214+
- ./certs:/etc/nginx/ssl
215+
ports:
216+
- "443:443"
217+
- "80:80"
218+
restart: unless-stopped
219+
networks:
220+
frontend:
221+
backend:
222+
223+
networks:
224+
backend:
225+
frontend:
221226
```
222227

223228
Lastly add your `cert.key` and `cert.crt` into your `certs/` folder and mount it to `/etc/nginx/ssl`.
@@ -266,23 +271,23 @@ If you are not comfortable / don't want to hardcode your Number for example and/
266271

267272
| Type | Example | Note |
268273
| :--------------------- | :------------------ | :--------------- |
269-
| Body | `{{@data.key}}` | |
270-
| Header | `{{#Content_Type}}` | `-` becomes `_` |
271-
| [Variable](#variables) | `{{.VAR}}` | always uppercase |
274+
| Body | `{{@(get data.key)}}` | |
275+
| Header | `{{#(get Content_Type)}}` | `-` becomes `_` |
276+
| [Variable](#variables) | `{{(get .VAR)}}` | always uppercase |
272277

273278
**Where to use:**
274279

275280
| Type | Example |
276281
| :---- | :--------------------------------------------------------------- |
277-
| Body | `{"number": "{{ .NUMBER }}", "recipients": "{{ .RECIPIENTS }}"}` |
278-
| Query | `http://sec-signal-api:8880/v1/receive/?@number={{.NUMBER}}` |
279-
| Path | `http://sec-signal-api:8880/v1/receive/{{.NUMBER}}` |
282+
| Body | `{"number": "{{ (get .NUMBER) }}", "recipients": "{{ (get .RECIPIENTS) }}"}` |
283+
| Query | `http://sec-signal-api:8880/v1/receive/?@number={{(get .NUMBER)}}` |
284+
| Path | `http://sec-signal-api:8880/v1/receive/{{(get .NUMBER)}}` |
280285

281286
You can also combine them:
282287

283288
```json
284289
{
285-
"content": "{{.NUMBER}} -> {{.RECIPIENTS}}"
290+
"content": "{{(get .NUMBER)}} -> {{(get .RECIPIENTS)}}"
286291
}
287292
```
288293

@@ -330,16 +335,16 @@ logLevel: info
330335
settings:
331336
messageTemplate: |
332337
You've got a Notification:
333-
{{}}
334-
At {{.timestamp}} on {{.date}}.
335-
Send using {{.NUMBER}}.
338+
{{@(get message)}}
339+
At {{@(get data.timestamp)}} on {{@(get data.date)}}.
340+
Send using {{(get .NUMBER)}}.
336341
337342
variables:
338343
number: "+123400001"
339344
recipients: ["+123400002", "group.id", "user.id"]
340345
341346
dataAliases:
342-
"": [{ alias: "msg", score: 100 }]
347+
"@message": [{ alias: "msg", score: 100 }]
343348
344349
blockedEndpoints:
345350
- /v1/about
@@ -415,30 +420,30 @@ This makes advanced [Message Templates](#message-templates) like this one possib
415420
```yaml
416421
settings:
417422
messageTemplate: |
418-
{{- $greeting := "Hello" -}}
419-
{{ $greeting }}, {{ @name }}!
420-
{{ if @age -}}
421-
You are {{ @age }} years old.
422-
{{- else -}}
423+
{{- $(get greeting) := (get "Hello") -}}
424+
{{ $(get greeting) }}, {{ @(get name) }}!
425+
{{ (get if) @(get age) -}}
426+
You are {{ @(get age) }} years old.
427+
{{- (get else) -}}
423428
Age unknown.
424-
{{- end }}
429+
{{- (get end) }}
425430
Your friends:
426-
{{- range @friends }}
427-
- {{ . }}
428-
{{- else }}
431+
{{- (get range) @(get friends) }}
432+
- {{ (get .) }}
433+
{{- (get else) }}
429434
You have no friends.
430-
{{- end }}
435+
{{- (get end) }}
431436
Profile details:
432-
{{- range $key, $value := @profile }}
433-
- {{ $key }}: {{ $value }}
434-
{{- end }}
435-
{{ define "footer" -}}
436-
This is the footer for {{ @name }}.
437-
{{- end }}
438-
{{ template "footer" . -}}
437+
{{- (get range) $(get key), $(get value) := @(get profile) }}
438+
- {{ $(get key) }}: {{ $(get value) }}
439+
{{- (get end) }}
440+
{{ (get define) (get "footer") -}}
441+
This is the footer for {{ @(get name) }}.
442+
{{- (get end) }}
443+
{{ (get template) (get "footer") (get .) -}}
439444
------------------------------------
440-
Content-Type: {{ #Content_Type }}
441-
Redacted Auth Header: {{ #Authorization }}
445+
Content-Type: {{ #(get Content_Type) }}
446+
Redacted Auth Header: {{ #(get Authorization) }}
442447
```
443448

444449
### API Token(s)
@@ -500,7 +505,7 @@ See [Placeholders](#placeholders).
500505

501506
> [!NOTE]
502507
> Every Placeholder Key will be converted into an Uppercase String.
503-
> Example: `number` becomes `NUMBER` in `{{.NUMBER}}`
508+
> Example: `number` becomes `NUMBER` in `{{(get .NUMBER)}}`
504509

505510
```yaml
506511
settings:
@@ -518,7 +523,7 @@ Use `messageTemplate` to configure:
518523
settings:
519524
messageTemplate: |
520525
Your Message:
521-
{{@message}}.
526+
{{@(get message)}}.
522527
Sent with Secured Signal API.
523528
```
524529

@@ -610,4 +615,4 @@ No worries check out the [Discussions](https://github.com/codeshelldev/secured-s
610615

611616
Logo designed by [@CodeShellDev](https://github.com/codeshelldev), All Rights Reserved.
612617

613-
This Project is not affiliated with the Signal Foundation.
618+
This Project is not affiliated with the Signal Foundation.

0 commit comments

Comments
 (0)