Secrets in code is bad practice because it puts the secrets in source control and gives them to anyone with access to the code.
You separate out the secrets to keep them secret.
You separate out the secrets to keep them secret.
My point is, make the code easy to clone in a runnable shape wihtout any hacking on host system.