Commit Graph

74 Commits

Author SHA1 Message Date
Fabio Manganiello 841643f3ff
Added `cachedir` to configuration. 2023-10-09 01:33:44 +02:00
Fabio Manganiello 5ca3757834
A more readable configuration for the `calendar` plugin.
The old type configuration
(`platypush.plugins.calendar.name.CalendarNamePlugin`) is a bit clunky.

Instead, since the type will always be a plugin, we should encourage
the use of `calendar.name` directly to identify the type.
2023-10-01 01:09:15 +02:00
Fabio Manganiello 453b6becae
FIX: We shouldn't expand `cfgfile` if it's empty.
continuous-integration/drone/push Build is passing Details
2023-09-21 01:18:15 +02:00
Fabio Manganiello 4c4a33dc7c
Added Bluetooth example configuration to sample config.yaml.
continuous-integration/drone/push Build is passing Details
2023-09-17 03:25:21 +02:00
Fabio Manganiello fa2b84a269
Updated example configuration for mqtt and mqtt-based plugins.
continuous-integration/drone/push Build is passing Details
2023-09-16 15:26:07 +02:00
Fabio Manganiello 3104a59f44
Better processing of configuration file parameters.
- Do `abspath`+`expanduser` on the configuration file path before
  checking if it exists.

- If the path doesn't exist, but the user explicitly passed a
  configuration file, then copy/create the default configuration
  under the specified directory.
2023-09-14 00:24:52 +02:00
Fabio Manganiello c69f97c0a5
Updated default config.yaml.
continuous-integration/drone/push Build is passing Details
The new configuration:

- Enables `backend.http` by default
- Removes the extra `config.auto.yaml` dependency
- Includes many more examples, lots of updates for existing examples,
  and extensive comments.
2023-09-04 02:22:46 +02:00
Fabio Manganiello 07c2eee890
Changed (fixed) default location for config dir if not existing.
Following some common UNIX conventions, if no configuration file is
specified and none exists under the default locations, then a new
configuration directory should be created under:

```
- if root: /etc/platypush
- else:
  - if XDG_CONFIG_HOME:
    - $XDG_CONFIG_HOME/platypush
  - else:
    - ~/.config/platypush
```
2023-09-04 02:19:13 +02:00
Fabio Manganiello a8255f3621
Pass the configuration file used by the application to the Alembic process.
The database settings could also be overridden in the configuration file
besides the command line.

We should therefore pass the path to the runtime configuration file, so
the Alembic process can initialize its configuration from the same file
and use the same settings.
2023-08-19 13:23:20 +02:00
Fabio Manganiello 1825b492b3
Replaced `Config.workdir` with `Config.get_workdir()`.
Again, Python < 3.9 doesn't like class properties.
2023-08-19 13:21:24 +02:00
Fabio Manganiello a8836f95f5
Support explicit `workdir` parameter override in `Config` constructor. 2023-08-19 13:15:29 +02:00
Fabio Manganiello 5bc82dfe64
s/Config._cfgfile/Config.config_file/g 2023-08-19 13:13:36 +02:00
Fabio Manganiello ac83b43f98
Support for custom key-value overrides on `Config.init`. 2023-08-17 22:03:39 +02:00
Fabio Manganiello 657b2cc87d
Create the default configuration file even if --config is supplied but the file doesn't exist.
continuous-integration/drone/push Build is failing Details
2023-08-17 11:25:49 +02:00
Fabio Manganiello 91cd08cdff
Adapted tests to use a locally started Redis instance. 2023-07-24 10:37:07 +02:00
Fabio Manganiello 7a20fec52f
[#60] Added `--workdir` and `--logsdir` command-line options.
Also, the application is now using `XDG_CONFIG_HOME` and
`XDG_DATA_HOME` if available to lookup the configuration file and
working directory.

Closes: #60
2023-07-24 03:29:08 +02:00
Fabio Manganiello 77ffefdccb
Added a `Config.set` method.
A useful interface to change configuration values at runtime.
2023-07-24 00:48:07 +02:00
Fabio Manganiello 315a89fb65
Added a `default` parameter to `Config.get`. 2023-07-23 23:31:57 +02:00
Fabio Manganiello d49e5b1f6a
Expose `Config.workdir` property.
This is a useful proxy to avoid using `Config.get('workdir')` string
lookup.
2023-07-22 15:11:58 +02:00
Fabio Manganiello c846c61493
Refactored `Config.__init__`.
The constructor of the `Config` class had grown too big. It's much more
manageable if split into multiple sub-constructor helpers.
2023-07-15 13:38:07 +02:00
Fabio Manganiello 0a3d6add83
Support `./config.yaml` as a config file location. 2023-07-15 01:29:41 +02:00
Fabio Manganiello a8d2261f32
Added `core_plugins` to the configuration.
These plugins (only including `variable` for now) are a core part of the
application and should always be explicitly enabled.
2023-04-29 11:34:34 +02:00
Fabio Manganiello b96838a856
Major LINT fixes/refactor for the `Config` class 2023-02-04 17:35:48 +01:00
Fabio Manganiello 219a0a99ca `main.db` should use the configured `workdir` when not specified.
Closes: #234
Reviewed-On: #234
2022-12-09 23:37:10 +01:00
Fabio Manganiello a5db599268
FIX: Skip empty lines on `config.include` 2022-10-14 20:56:18 +02:00
Fabio Manganiello db45d7ecbf
FIX: More robust logic against section configurations that may not be maps 2022-08-31 01:27:53 +02:00
Fabio Manganiello 3edb8352b4
Support sections with empty bodies in the YAML configuration files. 2022-07-16 02:09:22 +02:00
Fabio Manganiello 371fd7e46b
Generate a default config.yaml if none is present instead of failing 2022-04-27 13:57:42 +02:00
Fabio Manganiello a80adc996f [WIP] Default config.yaml in case a configuration file is missing in the default locations 2022-04-25 16:54:26 +02:00
Fabio Manganiello 3bfc5b83ef Moved to manifest files for describing plugins and backends and their dependencies 2021-09-16 17:53:40 +02:00
Fabio Manganiello 6f224cbda9 Removed legacy "local" backend and pusher script 2021-03-13 01:52:15 +01:00
Fabio Manganiello 39abdfe40a New Vue.js template for dashbord WIP 2020-11-21 01:12:08 +01:00
Fabio Manganiello 1c84659e34 Support for Python cronjobs in scripts folder - closes #156 2020-10-13 23:25:27 +02:00
Fabio Manganiello dc1b54961f Added `inspect.get_config()` method to get the configuration programmatically 2020-08-31 18:26:08 +02:00
Fabio Manganiello 124269776d Support for procedure imports from scripts base module 2020-04-10 20:59:32 +02:00
Fabio Manganiello 25ea0ea77c Included scripts_dir parent dir on sys.path so scripts can import members through the "scripts" package 2020-04-10 00:40:46 +02:00
Fabio Manganiello 0dae03551f Implemented interface for custom Python scripts, procedures and hooks [closes #131] 2020-04-08 23:22:54 +02:00
Fabio Manganiello a5c08ed3e4 Added PicoVoice plugin with support for hotwords [see #130] 2020-03-07 02:00:35 +01:00
Fabio Manganiello be5c5d365c Added execute tab to webpanel 2019-12-08 16:25:03 +01:00
Fabio Manganiello 675b690929 switches should not be considered as a special token in the Config object 2019-12-04 02:58:45 +01:00
Fabio Manganiello 346b1be924 Filter out in get_plugins the special configuration fields not associated with plugins 2019-12-01 23:53:14 +01:00
Fabio Manganiello a18452ab2e Made procedure.[sync|async].name second argument optional
A procedure will be sync if [sync|async] is not specified
2019-12-01 16:48:57 +01:00
Fabio Manganiello dcb4a36959 Replaced os.environ['HOME'] with os.path.expanduser('~') (Windows compatibility)
Solves #74
2019-07-29 00:03:01 +02:00
Fabio Manganiello 9f008aa954 typo 2019-03-17 01:41:00 +01:00
Fabio Manganiello 7fb53ead59 Always cast environment variable values to string 2019-03-17 01:39:24 +01:00
Fabio Manganiello 2f1cea99fa Support for environment variables passed through main config 2019-03-17 01:34:42 +01:00
Fabio Manganiello 09c1598829 More flexible management for included config files paths 2018-12-30 20:18:55 +01:00
Fabio Manganiello 725b3dd672 Included reference to the included files in Config 2018-12-19 23:39:41 +01:00
Fabio Manganiello 6a9ddb9e53 Made config relative paths and include files expansion more robust 2018-12-19 09:19:58 +01:00
Fabio Manganiello f9b23afbb6 Fixed typo on main.db 2018-12-18 22:20:33 +01:00