-
Notifications
You must be signed in to change notification settings - Fork 4
fix: validating undefined connection strings #44
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8525a1b
Error if invalid connection
hallvictoria 7dbe27b
Error for all types
hallvictoria 0bdd1ee
Validate during type init
hallvictoria 2cc7976
Missed refs
hallvictoria 63e32ab
Removed testing line
hallvictoria c6bd5f8
moved to utils class
hallvictoria 8c11081
Merge branch 'dev' into hallvictoria/invalid-connection-string
hallvictoria c3c8099
Merge branch 'dev' into hallvictoria/invalid-connection-string
hallvictoria 4a115fc
license for utils
hallvictoria fb81938
Merge branch 'dev' of https://github.com/Azure/azure-functions-python…
hallvictoria a0d1511
refactor to use pydantic validator
hallvictoria 1c5ff7f
added field
hallvictoria 04587a8
added check for whitespace
9d48bde
Merge branch 'dev' into hallvictoria/invalid-connection-string
hallvictoria 10583ca
feedback
f7a863f
Merge branch 'hallvictoria/invalid-connection-string' of https://gith…
e34a50f
lint
049ae01
Merge branch 'dev' into hallvictoria/invalid-connection-string
hallvictoria 93c7df8
revert pydantic changes
hallvictoria 46711c2
fix tests for base change
hallvictoria 3a8e5f1
no validation on connection string obj
10599d1
fixing tests
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
21 changes: 21 additions & 0 deletions
21
azurefunctions-extensions-bindings-blob/azurefunctions/extensions/bindings/blob/utils.py
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,21 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
import os | ||
|
||
|
||
def validate_connection_string(connection_string: str) -> str: | ||
""" | ||
Validates the connection string. If the connection string is | ||
not an App Setting, an error will be thrown. | ||
""" | ||
if connection_string == None: | ||
raise ValueError( | ||
"Storage account connection string cannot be none. " | ||
"Please provide a connection string." | ||
) | ||
elif not os.getenv(connection_string): | ||
raise ValueError( | ||
f"Storage account connection string {connection_string} does not exist. " | ||
f"Please make sure that it is a defined App Setting." | ||
) | ||
return os.getenv(connection_string) |
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
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.
Uh oh!
There was an error while loading. Please reload this page.