Skip to content
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

[#1515] Remove worker container from local environments #1552

Merged
merged 11 commits into from
Oct 27, 2022
Prev Previous commit
Next Next commit
use loguru for all logs in the setup_server hook to prevent regular l…
…ogger logs being swallowed
  • Loading branch information
Sean Preston committed Oct 26, 2022
commit 66e684e282020031f588d637e92f8c05d95f431e
25 changes: 10 additions & 15 deletions src/fides/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,16 @@ def configure_routes() -> None:
@app.on_event("startup")
async def setup_server() -> None:
"Run all of the required setup steps for the webserver."
logger.warning(
"Startup configuration: reloading = %s, dev_mode = %s",
CONFIG.hot_reloading,
CONFIG.dev_mode,
log.warning(
f"Startup configuration: reloading = {CONFIG.hot_reloading}, dev_mode = {CONFIG.dev_mode}",
)
logger.warning(
"Startup configuration: pii logging = %s",
getenv("FIDES__LOG_PII", "").lower() == "true",
log_pii = getenv("FIDES__LOG_PII", "").lower() == "true"
log.warning(
f"Startup configuration: pii logging = {log_pii}",
)

if logger.getEffectiveLevel() == logging.DEBUG:
logger.warning(
log.warning(
"WARNING: log level is DEBUG, so sensitive or personal data may be logged. "
"Set FIDES__LOGGING__LEVEL to INFO or higher in production."
)
Expand All @@ -211,29 +209,26 @@ async def setup_server() -> None:

await configure_db(CONFIG.database.sync_database_uri)

logger.info("Validating SaaS connector templates...")
log.info("Validating SaaS connector templates...")
registry = load_registry(registry_file)
try:
db = get_api_session()
update_saas_configs(registry, db)
finally:
db.close()

logger.info("Running Redis connection test...")
log.info("Running Redis connection test...")

try:
get_cache()
except (RedisConnectionError, ResponseError) as e:
logger.error("Connection to cache failed: %s", Pii(str(e)))
log.error("Connection to cache failed: %s", Pii(str(e)))
return

if not scheduler.running:
scheduler.start()

logger.info("Starting scheduled request intake...")
initiate_scheduled_request_intake()

logging.debug("Sending startup analytics events...")
log.debug("Sending startup analytics events...")
await send_analytics_event(
AnalyticsEvent(
docker=in_docker_container(),
Expand Down
10 changes: 3 additions & 7 deletions src/fides/ctl/core/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import toml
from fideslib.core.config import load_toml
from loguru import logger as log
from pydantic import BaseModel

from fides.ctl.core.utils import echo_red
Expand All @@ -26,8 +27,6 @@
from .user_settings import UserSettings
from .utils import DEFAULT_CONFIG_PATH, get_test_mode

logger = logging.getLogger(__name__)


class FidesConfig(BaseModel):
"""Umbrella class that encapsulates all of the config subsections."""
Expand Down Expand Up @@ -65,11 +64,8 @@ def log_all_config_values(self) -> None:
self.admin_ui,
]:
for key, value in settings.dict().items(): # type: ignore
logger.debug(
"Using config: %s%s = %s",
settings.Config.env_prefix, # type: ignore
key.upper(),
value,
log.debug(
f"Using config: {settings.Config.env_prefix}{key.upper()} = {value}",
)


Expand Down