bitwarden-crd-operator/src/bitwardenCrdOperator.py

16 lines
409 B
Python
Raw Normal View History

2022-11-12 22:57:42 +00:00
#!/usr/bin/env python3
import kopf
import os
from utils.utils import command_wrapper, unlock_bw
2022-11-12 22:57:42 +00:00
@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)