If you're running Apache, you can also set this in your .htaccess file, I believe.
Code:
SetEnv CI_ENV production
Additionally, you can just do some logic in the main index.php file to check the current $_SERVER['HTTP_HOST'] to determine which environment should be set.