Git Product home page Git Product logo

Comments (5)

hampoelz avatar hampoelz commented on August 9, 2024

Regarding the environment variables, are there any particular advantages? If so, I would consider adding some as presets which can be toggled in the start options. Allowing to set every env variable would be out of scope of this plugin.

from capacitor-nodejs.

 avatar commented on August 9, 2024

My app is built like https://12factor.net/ (except secrets can come from things like docker or vault nowadays). The database url (sqlite in this case) mounted path and other things come from env variables.

from capacitor-nodejs.

 avatar commented on August 9, 2024

I wasn't exactly clear what I wanted the signature to look like. Something like https://nodejs.org/api/child_process.html#child_processspawncommand-args-options , but obviously it's not a being treated as a child process here so we can omit most of the args.

so it'd look like

// this is basically node's definition of process.env minus the generic
interface EnvVars {
 [key: string]: string | undefined;
}

interface StartOptions {
  env: EnvVars;
  // any other options could be added here, like cwd 
}
// not really tied to this name
start(fileName: string, args: string[], opts: StartOptions)

from capacitor-nodejs.

hampoelz avatar hampoelz commented on August 9, 2024

I like your idea. However, this wouldn't work with the current ElectronJS integration as it is. Therefore the implementation will take some time.

from capacitor-nodejs.

hampoelz avatar hampoelz commented on August 9, 2024

Added in v1.0.0-beta.4

You can now use the startMode configuration and the start() method to manually start the Node.js runtime. In addition, arguments can be passed to the main script and environment variables for the Node.js runtime can be set.

from capacitor-nodejs.

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.