Last active
January 14, 2022 01:45
-
-
Save thunderrun/3c86776417b907a61d2c61b314727ef4 to your computer and use it in GitHub Desktop.
Get Env Prefix from Url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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