mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-29 22:24:37 +02:00
feat: Rename generator configuration JSON object key
This commit is contained in:
parent
1b85bfcda6
commit
bd3e19de62
@ -9,13 +9,13 @@ The file `generator.py` provides a list of static file generator classes. Each c
|
||||
The configuration file `config.json` is read which contains the configuration for the API.
|
||||
By specifying the name of the generator in the `generators` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
|
||||
|
||||
The following API configuration generates the `contributor` and `release` API for selected repositories:
|
||||
The following configuration generates static files using the `contributors` and `releases` generator for selected repositories:
|
||||
|
||||
```json
|
||||
{
|
||||
"api": [
|
||||
{
|
||||
"generators": ["release", "contributor"],
|
||||
"generators": ["releases", "contributors"],
|
||||
"repositories": ["user/repo"]
|
||||
}
|
||||
]
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"api": [
|
||||
"configs": [
|
||||
{
|
||||
"generators": [
|
||||
"release+contributor"
|
||||
|
12
main.py
12
main.py
@ -4,13 +4,13 @@ from app.generator import DefaultGeneratorProvider
|
||||
config = load_config()
|
||||
|
||||
output = config["output"]
|
||||
apis = config["api"]
|
||||
configs = config["configs"]
|
||||
|
||||
api_provider = DefaultGeneratorProvider()
|
||||
generator_provider = DefaultGeneratorProvider()
|
||||
|
||||
for api in apis:
|
||||
for generator_name in api["generators"]:
|
||||
generator = api_provider.get(generator_name)
|
||||
for config in configs:
|
||||
for generator_name in config["generators"]:
|
||||
generator = generator_provider.get(generator_name)
|
||||
if generator is None:
|
||||
continue
|
||||
generator.generate(api, output)
|
||||
generator.generate(config, output)
|
||||
|
Loading…
x
Reference in New Issue
Block a user