-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Apprise notification service. #1589
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
APPRISE_API_URL=http://localhost:8000 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,21 @@ const NotificationSchema = mongoose.Schema( | |
}, | ||
type: { | ||
type: String, | ||
enum: ["email", "sms"], | ||
enum: ["email", "sms", "apprise"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
}, | ||
appriseUrl: { | ||
type: String, | ||
validate: { | ||
validator: function(v) { | ||
if (this.type !== 'apprise') return true; | ||
if (!v || v.length > 2048) return false; | ||
|
||
// Apprise URL format: scheme://[user:pass@]host[:port]/path | ||
const appriseUrlRegex = /^[a-zA-Z]+:\/\/([^:\s]+:[^@\s]+@)?[^\s\/:]+(:\d+)?(\/[^\s]*)?$/; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This regex will also allow for invalid Apprise URLs, this will match for any alphabetical string for schema, like If we want to strictly verify Apprise URLs only, we'll have to match for all the specific protocols. Otherwise we may as well just verify that this is a string and leave the responsibility for a valid URL with the user. |
||
return appriseUrlRegex.test(v); | ||
}, | ||
message: 'Invalid Apprise URL: Must be a valid service URL under 2048 characters' | ||
} | ||
}, | ||
address: { | ||
type: String, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
apprise-api: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image: caronc/apprise-api:latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
container_name: apprise-api | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- "8000:8000" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
environment: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- APPRISE_STATELESS_MODE=yes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
restart: unless-stopped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Yo, this Docker config needs some sauce! 🍝 My sweaty palms spotted these issues in the Docker recipe:
Here's a beefed-up config that won't make your knees weak: apprise-api:
- image: caronc/apprise-api:latest
+ image: caronc/apprise-api:v1.0.0 # Replace with actual stable version
container_name: apprise-api
ports:
- "8000:8000"
environment:
- APPRISE_STATELESS_MODE=yes
- restart: unless-stopped
+ restart: unless-stopped
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ deploy:
+ resources:
+ limits:
+ cpus: '0.50'
+ memory: 256M
+ reservations:
+ cpus: '0.25'
+ memory: 128M 📝 Committable suggestion
Suggested change
🧰 Tools🪛 yamllint (1.35.1)[error] 8-8: no new line character at the end of file (new-line-at-end-of-file) [error] 8-8: trailing spaces (trailing-spaces) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.env files shouldn't be committed, best to remove this commit entirely