fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.8 KiB

  1. # -*- ispell-local-dictionary: "english" -*-
  2. * Usage
  3. ** Basic usage
  4. #+begin_src yaml
  5. ntfy:
  6. options:
  7. ## These are default of the charm (different from default of `ntfy`)
  8. #auth-default-access: deny-all
  9. #enable-signup: false
  10. #enable-login: true
  11. #enable-reservations: true
  12. #+end_src
  13. Any option from the help of [[https://docs.ntfy.sh/config/][ntfy]] can be used, to the exception of ~firebase-key-file~.
  14. To setup ~firebase~, there are some slight differences you can find here.
  15. *** Creating an admin account
  16. By default, =ntfy= doesn't provide any account nor permissions. This
  17. charm will enforce a different stance, and by default will not allow
  18. anything without permission.
  19. If you want to follow this route, you'll need to create an admin account:
  20. You need to attach to the ntfy container:
  21. #+begin_src sh
  22. docker exec -ti myproject_ntfy_1 sh
  23. #+end_src
  24. #+begin_src sh
  25. ntfy user add --role=admin admin
  26. #+end_src
  27. *** Adding user
  28. For listening topics
  29. #+begin_src sh
  30. ntfy user add myuser
  31. #+end_src
  32. To set access to topics
  33. #+begin_src sh
  34. ntfy access myuser mytopic read-only
  35. #+end_src
  36. *** Create a token for a user
  37. This allows to give a kind of secret key that is revokable. You would
  38. do this to distribute access to services that would need to send
  39. notification.
  40. To create a token from a user:
  41. #+begin_src sh
  42. ntfy token add admin
  43. #+end_src
  44. ** Connection with =Firebase=
  45. I you build your own Android/IOS ntfy app, you can use Firebase Cloud
  46. Messaging (FCM) to send notification through official channel. To
  47. configure your server to send notification with Firebase you can:
  48. #+begin_src yaml
  49. ntfy:
  50. options:
  51. firebase: ## content of your firebase service key file in yaml
  52. type: service_account
  53. project_id: myfirebase-project
  54. private_key_id: 0ebce...41480
  55. private_key: |
  56. -----BEGIN PRIVATE KEY-----
  57. MzynkLGbScqN4XAWCU84Q6LLi6MFsnDyrA883Cdkttg1zI62q/BohgIck+897oyb
  58. ..
  59. ifQT/X7DVZl42p0M1mwwdAS8Ig==
  60. -----END PRIVATE KEY-----
  61. client_email: firebase-adminsdk-fodhh@ntfy-0k.iam.gserviceaccount.com
  62. client_id: "101777552980915316312"
  63. auth_uri: https://accounts.google.com/o/oauth2/auth
  64. token_uri: https://oauth2.googleapis.com/token
  65. auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
  66. client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fxdhj%40myfirebase-project.iam.gserviceaccount.com
  67. #+end_src
  68. To produce the output from the private service key file you created in
  69. =Firebase= you could:
  70. #+begin_src sh
  71. cat myfirebase-project-firebase-adminsdk-fxdhj-6eaewk4a4.json | yq -p json -o yaml
  72. #+end_src
  73. To get more information about how to deploy your own app [[https://docs.ntfy.sh/config/#firebase-fcm][ntfy's doc
  74. about FCM]] might be helpful.