Giter VIP home page Giter VIP logo

Comments (10)

fivetanley avatar fivetanley commented on June 16, 2024

Hi @lolmaus. Do you have a reproduction project? Unfortunately I'm not using this with any FastBoot projects at the moment.

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on June 16, 2024

@kratiahuja do you mind to share some thoughts or ideas about how to solve this issue? I faced the same problem and I'd like to contribute to the addon to support that feature but have a difficult time thinking about how to integration this into ember-cli-fastboot properly.

from ember-cli-dotenv.

kratiahuja avatar kratiahuja commented on June 16, 2024

How about write it to the package.json of Fastboot as part of the app config? I am working on exposing an API on fastboot where you can write additional config at build time and read it in Fastboot via FastBoot.config

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on June 16, 2024

How about write it to the package.json of Fastboot as part of the app config?

That would work and that's what I;d like to achieve!
The main problem here is: how to make some config to appear in package.json and do not appear in <meta name="{{modulePrefix}}/config/environment">?
I see that package.jsom is populated with the same content as <meta name="{{modulePrefix}}/config/environment"> at build time (according to ember-cli-fastboot/index.js)

I'm looking into some option to allow an addon like this one to tell ember-cli-fastboot "Hey, here is some extra params you should include in package.json" but at the same time these vars should be ignored by ember-cli itself and not added to resulting index.html?
Or maybe the addon like this one can run on Broccoli tree after ember-cli-fastboot and update package.json after it's produced. Not sure what would be the best option.

I am working on exposing an API on Fastboot where you can write additional config at build time and read it in Fastboot via FastBoot.config

@kratiahuja are you talking about ember-fastboot/ember-cli-fastboot#515? That also could be a workaround. If I got it correctly I would need to create config/environment module with some prefix, like {{app-name}}-fastboot/config/environment.
Then there would be similar problem - how to make this {{app-name}}-fastboot/config/environment not available in client-side app and not delivered to browser at all?

I can do first option with "patching" package.json at build time but need some guidance.

from ember-cli-dotenv.

kratiahuja avatar kratiahuja commented on June 16, 2024

are you talking about ember-fastboot/ember-cli-fastboot#515

Yes. You don't need to create config/environment module. you can just write key value pair in the config.

from ember-cli-dotenv.

kratiahuja avatar kratiahuja commented on June 16, 2024

@SergeAstapov it might be best to discuss this over slack. My point is package.json generated is never shipped to the browser so you could always write the contents in there and expose it in the server side app. Example is hostWhitelists in package.json as well.

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on June 16, 2024

@kratiahuja seems that I was confused by example in README.md from ember-fastboot/ember-cli-fastboot#515 PR:

Addons wishing to use this hook simply need to return a unique identifier for the configuration with the configuration.

fastbootConfigTree() {
 return {
   '<engine-name>/config/environment': {
     'foo': 'bar'
   }
 }
}

and did not pay attention to the fact that '<engine-name>/config/environment' would be a key on appConfig and available in the app in FastBoot mode via

import ENV from 'app-name/config/environment';
...
ENV['<engine-name>/config/environment']

Now I've got the idea and would proceed with PR to ember-cli-dotenv with fastbootConfigTree hook support.

from ember-cli-dotenv.

kratiahuja avatar kratiahuja commented on June 16, 2024

@SergeAstapov fastbootConfigTree hook hasn't landed yet. You would need to wait for it to land and then use it with checking the minimal version of ember-cli-fastboot that supports the hook in the host app.

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on June 16, 2024

@kratiahuja thanks for note about checking the minimal version of ember-cli-fastboot!
We'll need to mention in PR that it can land only after ember-fastboot/ember-cli-fastboot#515 is merged and new releases of both fastboot and ember-cli-fastboot are out.

Similar way how you cross linked PR's between fastboot and ember-cli-fastboot.

from ember-cli-dotenv.

SergeAstapov avatar SergeAstapov commented on June 16, 2024

Closed via #50. Published 2.2.0

from ember-cli-dotenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.