-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Unify various API endpoints related to config
More details in the linked issue. Closes #1960
- Loading branch information
Showing
27 changed files
with
274 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import capellacollab | ||
from capellacollab.config import config | ||
from capellacollab.settings.configuration import models | ||
|
||
|
||
def get_metadata( | ||
global_config: models.GlobalConfiguration, | ||
) -> models.Metadata: | ||
return models.Metadata.model_validate( | ||
global_config.metadata.model_dump() | ||
| { | ||
"version": capellacollab.__version__, | ||
"host": config.general.host, | ||
"port": str(config.general.port), | ||
"protocol": config.general.scheme, | ||
} | ||
) | ||
|
||
|
||
def get_feedback( | ||
global_config: models.GlobalConfiguration, | ||
) -> models.FeedbackConfiguration: | ||
feedback = global_config.feedback | ||
if not (config.smtp and config.smtp.enabled): | ||
feedback.enabled = False | ||
feedback.after_session = False | ||
feedback.on_footer = False | ||
feedback.on_session_card = False | ||
feedback.interval.enabled = False | ||
|
||
return feedback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.