@@ -37,15 +37,9 @@ def start(
3737 bool , Option ("--reload" , "-r" , help = "Reload the server when the code changes (for development)" )
3838 ] = False ,
3939 ):
40- # initialize the config if not already
41- if not bbcfg .get_api_keys ():
42- self .log .info ("First run detected. Adding a new API key..." )
43- self .root .children ["server" ].children ["apikey" ].setup ()
44- self .root .children ["server" ].children ["apikey" ].add ()
45- bbcfg .refresh ()
46-
4740 if api_only :
4841 print ("Starting BBOT server API" )
42+
4943 import uvicorn
5044
5145 app = "bbot_server.api.app:server_app"
@@ -86,6 +80,14 @@ async def run_watchdog():
8680 asyncio .run (run_watchdog ())
8781
8882 else :
83+ # initialize the config if not already
84+ if not bbcfg .get_api_keys ():
85+ self .log .info ("First run detected. Adding a new API key..." )
86+ self .root .children ["server" ].children ["apikey" ].setup ()
87+ self .root .children ["server" ].children ["apikey" ].add ()
88+ else :
89+ self .log .info ("API keys already exist. Skipping API key creation." )
90+
8991 # docker compose command with env vars
9092 env = os .environ .copy ()
9193 env ["BBOT_LISTEN_ADDRESS" ] = listen
@@ -182,7 +184,9 @@ def _run_docker_compose(self, args, **kwargs):
182184 except (FileNotFoundError , subprocess .CalledProcessError ):
183185 raise typer .Exit ("Docker compose is not installed. Please install docker compose and try again." )
184186
185- return run (self ._docker_command + args , ** kwargs )
187+ docker_compose_command = self ._docker_command + args
188+ self .log .info (f"Running docker compose command: { ' ' .join (docker_compose_command )} " )
189+ return run (docker_compose_command , ** kwargs )
186190
187191 @subcommand (
188192 help = "Run a command with docker compose" ,
0 commit comments