2022-11-12 22:57:42 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import kopf
|
|
|
|
import os
|
|
|
|
|
2022-11-26 12:49:57 +00:00
|
|
|
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)
|
|
|
|
|