Skip to content

improve error logging, and fix defualt casting - #371

Merged
orweis merged 3 commits into
masterfrom
confi-fixes
Feb 8, 2023
Merged

orweis merged 3 commits into
masterfrom
confi-fixes

Conversation

@orweis

@orweis orweis commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

Signed-off-by: orweis orweis@gmail.com

Signed-off-by: orweis <orweis@gmail.com>
@netlify

netlify Bot commented Feb 1, 2023 •

Copy link
Copy Markdown

✅ Deploy Preview for opal-docs canceled.

Name Link
🔨 Latest commit 1cbb75d
🔍 Latest deploy log https://app.netlify.com/sites/opal-docs/deploys/63dd464ad6bc2a0008f50a69

@orweis
orweis requested a review from roekatz February 1, 2023 22:56
@orweis
orweis marked this pull request as ready for review February 1, 2023 23:21

@roekatz roekatz left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have different intuitions about the desired solution here:

  1. In case the user tries to override a default with a bad value (that fails to parse), OPAL should exit immediately with an error. Running with the default value in that case is certainly not what the user expects.
  2. Isn't it simpler to just set the correct types for the default values? (rather than basically extending decouple's behavior from the outside). (e.g. for POLICY_REPO_WEBHOOK_PARAMS: default=GitWebhookRequestParams({...}) instead of just the dict)

@orweis

orweis commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author
  1. In case the user tries to override a default with a bad value (that fails to parse), OPAL should exit immediately with an error. Running with the default value in that case is certainly not what the user expects.

Sure that's fair; I'll fix accordingly.

  1. Isn't it simpler to just set the correct types for the default values? (rather than basically extending decouple's behavior from the outside). (e.g. for POLICY_REPO_WEBHOOK_PARAMS: default=GitWebhookRequestParams({...}) instead of just the dict)

You are correct, but only when it comes to pydantic models - you forget other types that are being cast from strings: lists, enums, booleans, numbers, etc. etc.
Also I think it makes the config file itself less readable and cumbersome, you'd to mention the type 3 times (it's already 2 times now)

Signed-off-by: orweis <orweis@gmail.com>
Signed-off-by: orweis <orweis@gmail.com>
@orweis
orweis merged commit 2bf352f into master Feb 8, 2023
@zeevmoney
zeevmoney deleted the confi-fixes branch November 8, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants