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.

44 lines
1.3 KiB

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2021 CZ.NIC z.s.p.o. (https://www.nic.cz/)
  3. START=70
  4. USE_PROCD=1
  5. PROG=/usr/bin/miniflux.app
  6. start_service() {
  7. local config_file
  8. config_load miniflux
  9. procd_open_instance
  10. procd_set_param command "$PROG"
  11. procd_append_param user miniflux
  12. config_get config_file main config_file
  13. if [ -n "$config_file" ]; then
  14. procd_append_param command -config-file="$config_file"
  15. else
  16. local listen_address run_migrations database_url
  17. config_get listen_address main listen_address
  18. procd_append_param env LISTEN_ADDR="$listen_address"
  19. config_get run_migrations main run_migrations
  20. [ "$run_migrations" = 1 ] && procd_append_param env RUN_MIGRATIONS=1
  21. config_get database_url database url
  22. if [ -z "$database_url" ]; then
  23. local database_user database_password database_dbname database_sslmode
  24. config_get database_user database user
  25. config_get database_password database password
  26. config_get database_dbname database dbname
  27. config_get database_sslmode database sslmode
  28. database_url="user=$database_user password=$database_password dbname=$database_dbname sslmode=$database_sslmode"
  29. fi
  30. procd_append_param env DATABASE_URL="$database_url"
  31. fi
  32. procd_set_param file "$config_file"
  33. procd_set_param respawn
  34. procd_set_param stderr 1
  35. procd_close_instance
  36. }