Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Don't Merge] Feature/change dev endorser #910

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use_kwargs,
)
from aries_cloudagent.admin.request_context import AdminRequestContext
from aries_cloudagent.admin.server import AdminConfigSchema
from aries_cloudagent.messaging.models.base import BaseModelError
from aries_cloudagent.messaging.models.openapi import OpenAPISchema
from aries_cloudagent.messaging.valid import JSONWebToken, UUIDFour
Expand All @@ -21,6 +22,7 @@
from aries_cloudagent.multitenant.base import BaseMultitenantManager
from aries_cloudagent.multitenant.error import WalletKeyMissingError
from aries_cloudagent.storage.error import StorageError, StorageNotFoundError
from aries_cloudagent.version import __version__
from aries_cloudagent.wallet.error import WalletSettingsError
from aries_cloudagent.wallet.models.wallet_record import WalletRecord
from marshmallow import fields, validate
Expand Down Expand Up @@ -917,6 +919,41 @@ async def innkeeper_authentications_api_delete(request: web.BaseRequest):
return web.json_response({"success": result})


@docs(tags=[SWAGGER_CATEGORY], summary="Fetch the server configuration")
@response_schema(AdminConfigSchema(), 200, description="")
@innkeeper_only
@error_handler
async def innkeeper_config_handler(request: web.BaseRequest):
context: AdminRequestContext = request["context"]
# use base/root profile for server config, use Tenant Manager profile
# this is to not get the Innkeeper tenant's config, but the server cfg
mgr = context.inject(TenantManager)
profile = mgr.profile

config = {
k: (
profile.context.settings[k]
)
for k in profile.context.settings
if k
not in [
"admin.admin_api_key",
"multitenant.jwt_secret",
"wallet.key",
"wallet.rekey",
"wallet.seed",
"wallet.storage_creds",
]
}
try:
del config["plugin_config"]["traction_innkeeper"]["innkeeper_wallet"]["wallet_key"]
except KeyError as e:
LOGGER.warn(f"The key to be removed: '{e.args[0]}' is missing from the dictionary.")
config["version"] = __version__

return web.json_response({"config": config})


async def register(app: web.Application):
"""Register routes."""
LOGGER.info("> registering routes")
Expand Down Expand Up @@ -987,6 +1024,11 @@ async def register(app: web.Application):
"/innkeeper/authentications/api/{tenant_authentication_api_id}",
innkeeper_authentications_api_delete,
),
web.get(
"/innkeeper/server/status/config",
innkeeper_config_handler,
allow_head=False,
),
]
)
LOGGER.info("< registering routes")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
request_schema,
)
from aries_cloudagent.admin.request_context import AdminRequestContext
from aries_cloudagent.admin.server import AdminConfigSchema
from aries_cloudagent.messaging.models.openapi import OpenAPISchema
from aries_cloudagent.multitenant.admin.routes import (
format_wallet_record,
Expand All @@ -16,6 +17,7 @@
)
from aries_cloudagent.multitenant.base import BaseMultitenantManager
from aries_cloudagent.storage.error import StorageNotFoundError
from aries_cloudagent.version import __version__
from aries_cloudagent.wallet.models.wallet_record import (
WalletRecordSchema,
WalletRecord,
Expand Down Expand Up @@ -352,6 +354,55 @@ async def tenant_api_key_delete(request: web.BaseRequest):
return web.json_response({"success": result})


@docs(tags=[SWAGGER_CATEGORY], summary="Fetch the server configuration")
@response_schema(AdminConfigSchema(), 200, description="")
@error_handler
async def tenant_server_config_handler(request: web.BaseRequest):
context: AdminRequestContext = request["context"]
# use base/root profile for server config, use Tenant Manager profile
# this is to not get the Innkeeper tenant's config, but the server cfg
mgr = context.inject(TenantManager)
profile = mgr.profile

config = {
k: (
profile.context.settings[k]
)
for k in profile.context.settings
if k
not in [
"default_label",
"admin.admin_api_key",
"admin.admin_insecure_mode",
"admin.enabled",
"admin.host",
"admin.port",
"admin.webhook_urls",
"admin.admin_client_max_request_size",
"multitenant.jwt_secret",
"wallet.key",
"wallet.name",
"multitenant.wallet_name",
"wallet.storage_type",
"wallet.storage_config",
"wallet.rekey",
"wallet.seed",
"wallet.storage_creds",
]
}
try:
del config["plugin_config"]["traction_innkeeper"]["innkeeper_wallet"]
config["config"]["ledger.ledger_config_list"] = [
{k: v for k, v in d.items() if k != "genesis_transactions"}
for d in config["config"]["ledger.ledger_config_list"]
]
except KeyError as e:
LOGGER.warn(f"The key to be removed: '{e.args[0]}' is missing from the dictionary.")
config["version"] = __version__

return web.json_response({"config": config})


async def register(app: web.Application):
"""Register routes."""
LOGGER.info("> registering routes")
Expand All @@ -376,6 +427,11 @@ async def register(app: web.Application):
"/tenant/authentications/api/{tenant_authentication_api_id}",
tenant_api_key_delete,
),
web.get(
"/tenant/server/status/config",
tenant_server_config_handler,
allow_head=False
),
]
)
LOGGER.info("< registering routes")
Expand Down
42 changes: 3 additions & 39 deletions services/tenant-ui/frontend/src/components/about/Acapy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,8 @@
</div>

<div class="grid">
<div class="col-2">
{{ $t('about.acaPy.ledger') }}
</div>
<div class="col-10">
{{ config.frontend.ariesDetails.ledgerName }}
</div>

<div class="col-2">
{{ $t('about.acaPy.ledgerBrowser') }}
</div>
<div class="col-10">
{{ config.frontend.ariesDetails.ledgerBrowser }}
</div>

<div class="col-2">
{{ $t('about.acaPy.tailsServer') }}
</div>
<div class="col-10">
{{ config.frontend.ariesDetails.tailsServer }}
</div>
</div>

<div class="grid mt-4">
<div class="col-12 md:col-6 lg:col-4">
<Accordion>
<AccordionTab :header="$t('about.acaPy.plugins')">
<div v-if="loading" class="flex justify-content-center">
<ProgressSpinner />
</div>
<vue-json-pretty v-else :data="acapyPlugins" />
</AccordionTab>
</Accordion>
<PluginList />
</div>
</div>
</template>
Expand All @@ -56,15 +26,9 @@
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
// PrimeVue
import Accordion from 'primevue/accordion';
import AccordionTab from 'primevue/accordiontab';
import ProgressSpinner from 'primevue/progressspinner';
import VueJsonPretty from 'vue-json-pretty';

const { acapyPlugins, config, loading } = storeToRefs(useConfigStore());
const configStore = useConfigStore();
import PluginList from './PluginList.vue';

configStore.getPluginList();
const { config } = storeToRefs(useConfigStore());
</script>

<style scoped>
Expand Down
31 changes: 31 additions & 0 deletions services/tenant-ui/frontend/src/components/about/PluginList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<Accordion>
<AccordionTab :header="$t('about.acaPy.plugins')">
<div v-if="loading" class="flex justify-content-center">
<ProgressSpinner />
</div>
<vue-json-pretty v-else :data="acapyPlugins" />
</AccordionTab>
</Accordion>
</template>

<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { useConfigStore } from '@/store/configStore';
// PrimeVue
import Accordion from 'primevue/accordion';
import AccordionTab from 'primevue/accordiontab';
import ProgressSpinner from 'primevue/progressspinner';
import VueJsonPretty from 'vue-json-pretty';

const { acapyPlugins, loading } = storeToRefs(useConfigStore());
const configStore = useConfigStore();

configStore.getPluginList();
</script>

<style scoped>
.logo-acapy {
width: 14em;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<template>
<MainCardContent
:title="$t('serverConfig.serverConfig')"
:refresh-callback="loadConfig"
>
<ProgressSpinner v-if="loading" />
<div v-else>
<p>
<strong>{{ $t('serverConfig.acapyVersion') }}</strong>
{{ serverConfig?.config?.version }}
</p>
<p>
<strong>{{ $t('serverConfig.tractionProxy') }}</strong>
{{ config.frontend.tenantProxyPath }}
<a :href="swaggerUrl" target="_blank"> <i class="pi pi-external-link ml-2" /> </a>

Check warning on line 15 in services/tenant-ui/frontend/src/components/innkeeper/config/ServerConfig.vue

View workflow job for this annotation

GitHub Actions / Build Tenant UI

Replace `·<i·class="pi·pi-external-link·ml-2"·/>` with `⏎··········<i·class="pi·pi-external-link·ml-2"·/>⏎·······`
</p>

<div class="grid mt-3">
<div class="col">
<Fieldset
:legend="$t('serverConfig.ledger.ledgerDetails')"
:toggleable="true"
>
<p class="mt-0">
<strong>{{ $t('serverConfig.ledger.ledgerList') }}</strong>
</p>
<DataTable :value="ledgerConfigList" size="small" striped-rows>
<Column field="id" header="id"></Column>
<Column field="endorser_alias" header="endorser_alias"></Column>
<Column field="endorser_did" header="endorser_did"></Column>
</DataTable>
<p>
<strong>{{ $t('serverConfig.ledger.quickConnect') }}</strong>
{{ config.frontend.quickConnectEndorserName }}
</p>
<p>
<strong>{{ $t('serverConfig.ledger.default') }}</strong>
{{ serverConfig?.config?.['ledger.write_ledger'] }}
</p>
</Fieldset>

<PluginList class="mt-4" />

<Accordion class="mt-4">
<AccordionTab :header="$t('serverConfig.expand')">
<div v-if="loading" class="flex justify-content-center">
<ProgressSpinner />
</div>
<vue-json-pretty v-else :data="serverConfig" />
</AccordionTab>
</Accordion>
</div>

<div class="col">
<Fieldset
:legend="$t('serverConfig.tenantUi.tenantUi')"
:toggleable="true"
>
<p class="m-0"></p>
</Fieldset>
</div>
</div>
</div>
<vue-json-pretty :data="config" />
</MainCardContent>
</template>

<script setup lang="ts">
// Imports
import Accordion from 'primevue/accordion';
import AccordionTab from 'primevue/accordiontab';
import Column from 'primevue/column';
import DataTable from 'primevue/datatable';
import Fieldset from 'primevue/fieldset';
import ProgressSpinner from 'primevue/progressspinner';
import { storeToRefs } from 'pinia';
import { computed, onMounted } from 'vue';
import VueJsonPretty from 'vue-json-pretty';
import { useToast } from 'vue-toastification';
// Components
import { useConfigStore, useInnkeeperTenantsStore } from '@/store';
import MainCardContent from '../../layout/mainCard/MainCardContent.vue';
import PluginList from '@/components/about/PluginList.vue';

const toast = useToast();

const { config } = storeToRefs(useConfigStore());
const innkeeperTenantsStore = useInnkeeperTenantsStore();
const { loading, serverConfig } = storeToRefs(useInnkeeperTenantsStore());

onMounted(async () => {
loadConfig();
});

const loadConfig = async () => {
innkeeperTenantsStore.getServerConfig().catch((err: string) => {
console.error(err);
toast.error(`Failure: ${err}`);
});
};

const ledgerConfigList = computed(() => {
if (serverConfig.value?.config) {
return serverConfig.value.config['ledger.ledger_config_list'];
}
return [];
});

const swaggerUrl = computed(
() => `${config.value.frontend.tenantProxyPath}/api/doc`
);
</script>

<style scoped></style>
Loading
Loading