detectEnvironment not working as it should

hello, i'm using Coldbox.cfc in 3.1 and I'm getting this error:

Element ENVIRONMENT is undefined in CONFIGSTRUCT

as i'm trying to use my custom detectEnvironment() to detect
environment based on domain and directory path. Example of 3
environments:
sectest.mysite.com/logindev
sectest.mysite.com/logintest
secure.mysite.com/login

In the configure() i removed structure environments = {}. I added
string function detectEnvironment(){ ...my detect code here... } which
either returns a string "dev" or "stage" or "live". I also have my
environment methods
function dev(){}
function stage(){}
function live(){}.

Am I suppose to set the setting Environment myself? I thought Coldbox
would pick up my return string.