This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
forked from jic-dtool/dserver-search-plugin-mongo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jotelha/2022-11-22-config
All refactored repos to main
- Loading branch information
Showing
5 changed files
with
47 additions
and
30 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 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 |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import json | ||
import os | ||
|
||
import dtool_lookup_server_search_plugin_mongo | ||
|
||
CONFIG_SECRETS_TO_OBFUSCATE = [ | ||
"SEARCH_MONGO_URI", | ||
"SEARCH_MONGO_DB", | ||
"SEARCH_MONGO_COLLECTION" | ||
] | ||
|
||
class Config(object): | ||
SEARCH_MONGO_URI = os.environ.get("SEARCH_MONGO_URI", "mongodb://localhost:27017/") | ||
SEARCH_MONGO_DB = os.environ.get("SEARCH_MONGO_DB", "dtool_info") | ||
SEARCH_MONGO_COLLECTION = os.environ.get("SEARCH_MONGO_COLLECTION", "datasets") | ||
|
||
@classmethod | ||
def to_dict(cls): | ||
"""Convert server configuration into dict.""" | ||
exclusions = [ | ||
# sensitive data, i.e. password | ||
] # config keys to exclude | ||
d = {"version": dtool_lookup_server_search_plugin_mongo.__version__} | ||
for k, v in cls.__dict__.items(): | ||
# select only capitalized fields | ||
if k.upper() == k and k not in exclusions: | ||
d[k.lower()] = v | ||
return d | ||
SEARCH_MONGO_COLLECTION = os.environ.get("SEARCH_MONGO_COLLECTION", "datasets") |
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