Skip to main content

How can i change uuid based on enviroment variables in js?

Comments

5 comments

  • Jonas Kroeger

    What UUID are you referring to, can you give an example?

    0
  • Pranab Dey

    Hi Jonas,

    suppose if i want to place 3 different scripts dynamically based on the environment in JS. how do I proceed with that? is it possible without CLI?

    0
  • Jonas Kroeger

    Our builds are environment-agnostic. But you can introduce different behaviour in your application with runtime variables, e.g. check the PLATFORM_BRANCH or create your own variable (e.g. to declare a prod vs a dev environment). See https://docs.platform.sh/development/variables.html for more info.

    0
  • Pranab Dey

    I checked the docs. some doubts i have -
    So, suppose multiple variables I need to use. should I define it in plaform.app.yml or settings.plaformsh.php?
    and this is the way I need to define right -

    variables:
        d8config:
            "system.site:name": 'My site rocks'
       env:
            AUTHOR: 'Juan'
    

    and can I use any names for variables?

    0
  • Jonas Kroeger

    Since you want different values based on the environment, you would use environment variables. See https://docs.platform.sh/development/variables.html#environment-variables

    Note: This is all server side, if you need to do this client side you have to use a different approach (see here).

    0

Please sign in to leave a comment.