FreedomBox/doc/dev/reference/app_module.rst
Sunil Mohan Adapa 80498919fb
doc: Add developer documentation using Sphinx
- This is completely reworked but based on /Developer page in the FreedomBox
  Manual.

- This documentation can be made available as static site on
  https://docs.freedombox.org and the /Developer page in the FreedomBox Manual
  can be dropped.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2019-11-02 13:51:14 -04:00

38 lines
1.3 KiB
ReStructuredText

.. SPDX-License-Identifier: CC-BY-SA-4.0
App Module
----------
These methods are optionally provided by the module in which an app is
implemented and FreedomBox calls/uses them if they are present.
<app-module>.init()
^^^^^^^^^^^^^^^^^^^
Optional. This method is called by FreedomBox soon after all the applications
are loaded. The ``init()`` call order guarantees that other applications that
this application depends on will be initialized before this application is
initialized.
<app-module>.diagnose()
^^^^^^^^^^^^^^^^^^^^^^^
Optional. Called when the user invokes system-wide diagnostics by visiting
**System -> Diagnositcs**. This method must return an array of diagnostic
results. Each diagnostic result must be a two-tuple with first element as a
string that is shown to the user as name of the test and second element is the
result of the test. It must be one of ``passed``, ``failed``, ``error``. Example
return value:
.. code-block:: python3
[('Check http://localhost/app is reachable', 'passed'),
('Check configuration is sane', 'passed')]
<app-module>.depends
^^^^^^^^^^^^^^^^^^^^
Optional. This module property must contain a list of all apps that this
application depends on. The application is specified as string containing the
full module load path. For example, ``names``.