-
Notifications
You must be signed in to change notification settings - Fork 0
[webhooks] configurable action keywords #41
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
Open
capcom6
wants to merge
1
commit into
master
Choose a base branch
from
webhooks/configurable-action-keywords
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,6 +1,12 @@ | ||
| package webhooks | ||
|
|
||
| type KeywordEntry struct { | ||
| Status string `json:"status"` | ||
| Verb string `json:"verb"` | ||
| } | ||
|
|
||
| type Config struct { | ||
| Secret string `koanf:"secret"` | ||
| BotUserEmail string `koanf:"bot_user_email"` | ||
| Secret string | ||
| BotUserEmail string | ||
| ActionKeywords map[string]KeywordEntry | ||
| } |
This file contains hidden or 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 hidden or 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,9 @@ | ||
| package webhooks | ||
|
|
||
| import "errors" | ||
|
|
||
| var ( | ||
| ErrInvalidSignature = errors.New("invalid webhook signature") | ||
| ErrEmptyKeyword = errors.New("must not be empty") | ||
| ErrInvalidStatus = errors.New("invalid keyword status") | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
rg -n -C4 'ACTION_KEYWORDS|SetDefault' internal/config internal/webhooksRepository: bit-issues/backend
Length of output: 156
🏁 Script executed:
Repository: bit-issues/backend
Length of output: 206
🏁 Script executed:
Repository: bit-issues/backend
Length of output: 242
🏁 Script executed:
Repository: bit-issues/backend
Length of output: 15258
🏁 Script executed:
Repository: bit-issues/backend
Length of output: 3440
🌐 Web query:
koanf env provider empty environment variable map field override behavior💡 Result:
In koanf, the environment variable provider does not have a special "empty map field" override behavior where an empty environment variable explicitly clears or nullifies a nested field [1][2][3]. Instead, koanf's environment variable provider operates by loading key-value pairs and merging them into the existing configuration structure [1][4]. When you load configuration using the env provider: 1. Transformation and Nesting: If a delimiter (such as ".") is provided, the provider attempts to "unflatten" environment variable keys by splitting them at the delimiter [1][2][4]. For example, a key like "PARENT_CHILD" might be transformed into "parent.child" [1][2]. 2. Merging Behavior: The provider merges these loaded keys into the global configuration map [1][3]. It does not inherently distinguish between an "empty" value and a "missing" value in a way that triggers a deletion or nullification of a nested map field [1][3]. 3. Overwriting: If an environment variable key corresponds to an existing key in your configuration, the new value from the environment variable will overwrite the existing value [1][4]. If you provide an empty string as the value for an environment variable, it will simply overwrite the existing configuration value with an empty string, not remove or "empty out" a nested structure [1][2]. If you find that your nested maps are not being overridden as expected, it is often due to how keys are transformed or how the delimiter is used [5][6]. To ensure environment variables correctly map to your configuration structure, use a consistent transformation function to convert environment variable names into the expected configuration keys (e.g., converting "APP_DB_HOST" to "app.db.host") [1][4]. If you are experiencing issues where Unmarshal does not work as expected when using the env provider, ensure you are providing the correct delimiter to the provider to allow for proper map unflattening [7][8]. Without a delimiter, the provider may not correctly structure nested keys, which can lead to unexpected behavior during unmarshaling [7][8].
Citations:
USERnot loading knadh/koanf#319Populate
WEBHOOKS__ACTION_KEYWORDSin.env.example. The app has a built-in default map, but an empty env var will override that field during config load, so copied environments won’t get the documented webhook keyword transitions.🤖 Prompt for AI Agents