Feature/config service (#332)

Configuration service provides an API to change configuration. Complete configuration is pushed down a config queue so that users have a complete copy of config object.
This commit is contained in:
cybermaggedon 2025-04-01 19:47:05 +01:00 committed by GitHub
parent 21bda863a7
commit fa09dc319e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1002 additions and 5 deletions

View file

@ -79,6 +79,13 @@ def init(url, tenant="tg"):
}
})
ensure_namespace(url, tenant, "config", {
"retention_policies": {
"retentionSizeInMB": 50,
"retentionTimeInMinutes": -1,
}
})
def main():
parser = argparse.ArgumentParser(

View file

@ -0,0 +1,49 @@
#!/usr/bin/env python3
"""
Dumps out the current configuration
"""
import argparse
import os
from trustgraph.api import Api
import json
default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
def show_config(url):
api = Api(url)
config, version = api.get_config()
print("Version:", version)
print(json.dumps(config, indent=4))
def main():
parser = argparse.ArgumentParser(
prog='tg-show-config',
description=__doc__,
)
parser.add_argument(
'-u', '--api-url',
default=default_url,
help=f'API URL (default: {default_url})',
)
args = parser.parse_args()
try:
show_config(
url=args.api_url,
)
except Exception as e:
print("Exception:", e, flush=True)
main()