Skip to content

Instantly share code, notes, and snippets.

@thunderrun
Last active January 14, 2022 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thunderrun/3c86776417b907a61d2c61b314727ef4 to your computer and use it in GitHub Desktop.
Save thunderrun/3c86776417b907a61d2c61b314727ef4 to your computer and use it in GitHub Desktop.
Get Env Prefix from Url
const envPrefix = window.location.host.split('.')[0].match(/[^.\s]+-/) || '';
// https://charlie.alpha-Bravo.com/ -> ''
// https://dev-charlie.alpha-Bravo.com/ -> 'dev-'
export default envPrefix;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment