Giter Site home page Giter Site logo

Auto reload for goji? about goji HOT 5 CLOSED

zenazn avatar zenazn commented on July 17, 2024
Auto reload for goji?

from goji.

Comments (5)

peterhellberg avatar peterhellberg commented on July 17, 2024

You should be able to use Gin to do reloading of Goji if you bind to the PORT environment variable like so:

port := os.Getenv("PORT")

if port != "" {
    flag.Set("bind", ":"+port)
}

goji.Serve()

Iā€™d like this functionality to be included directly in Goji, it would be convenient when writing 12 factor apps

from goji.

zenazn avatar zenazn commented on July 17, 2024

@peterhellberg ā€” I'm not sure I follow: how is this relevant to 12-factor apps?

In any event, I wasn't planning on writing auto-reload functionality any time soon (although I've been sort of eyeing Facebook's watchman), so a third-party tool like Gin sounds like a great way to go. I've updated bind to work out-of-the-box with Gin (it now natively respects two additional environment variables: GOJI_BIND and PORT)

from goji.

peterhellberg avatar peterhellberg commented on July 17, 2024

@zenazn Related to factor 3 (Store config in the environment) and the fact that many web frameworks use the PORT variable. Thank you for the quick change šŸ‘

from goji.

peterhellberg avatar peterhellberg commented on July 17, 2024

And, just for posterity: It seems like fresh also work fine with Goji.

from goji.

zenazn avatar zenazn commented on July 17, 2024

Cool! Since there are a bunch of existing tools that seem to work okay, I'm going to close this issue for now.

from goji.

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.