bitwarden-crd-operator/src/bitwardenCrdOperator.py

16 lines
409 B
Python
Executable File

#!/usr/bin/env python3
import kopf
import os
from utils.utils import command_wrapper, unlock_bw
@kopf.on.startup()
def bitwarden_signin(logger, **kwargs):
if 'BW_HOST' in os.environ:
command_wrapper(logger, f"config server {os.getenv('BW_HOST')}")
else:
logger.info(f"BW_HOST not set. Assuming SaaS installation")
command_wrapper(logger, "login --apikey")
unlock_bw(logger)