Coder Social home page Coder Social logo

Comments (12)

zamith avatar zamith commented on May 26, 2024

The port should be coming from ENV, I believe. Is it not working for you?

from heroku-buildpack-crystal.

bcardiff avatar bcardiff commented on May 26, 2024

@arr-dev you can set the port in your program as

port = ENV["PORT"]?.try(&.to_i) || 8080

And it will work in heroku but then, instead of using a command line option you will need to set the environment variable. Totally viable, but I like more the command line option alternative.

from heroku-buildpack-crystal.

zamith avatar zamith commented on May 26, 2024

@arr-dev Does that answer your question? Can we close this?

from heroku-buildpack-crystal.

arr-dev avatar arr-dev commented on May 26, 2024

That wasn't clear by looking at the docs, but yes, sure, can be closed.

from heroku-buildpack-crystal.

zamith avatar zamith commented on May 26, 2024

@bcardiff Maybe we can add something on the README in this regard. What do you think?

from heroku-buildpack-crystal.

bcardiff avatar bcardiff commented on May 26, 2024

@zamith Yeap, I agree. A short section with port/binding description options and read more in the post it should be enough. Otherwise the people that reach this repo has no clue how to use it.

from heroku-buildpack-crystal.

zamith avatar zamith commented on May 26, 2024

@arr-dev Do you want to take a stab at it?

from heroku-buildpack-crystal.

arr-dev avatar arr-dev commented on May 26, 2024

@zamith Sure, I'll give it a go.

from heroku-buildpack-crystal.

zamith avatar zamith commented on May 26, 2024

Awesome. Thanks a lot.

from heroku-buildpack-crystal.

arr-dev avatar arr-dev commented on May 26, 2024

Tried to formulate it in #7, but when I thought about it,
I wanted to change linked blog post more than the README,
since that was the actual cause of my confusion.

Can I ask what's the rationale in setting port from CLI instead of using ENV["PORT"]?
It seems much easier for apps to just read ENV.

from heroku-buildpack-crystal.

bcardiff avatar bcardiff commented on May 26, 2024
  1. I think it is more common to pass options in CLI than in ENV.
  2. The --port $PORT was already there :-)
  3. Rails and other programs that starts an http server use --port

I know that crystal foo.cr -- --port 9090 might be confusing but usually the default port should be fine in development. When foo is compiled, ./foo --port 9090 looks better that PORT=9090 ./foo IMO.

This whole story might get simplified if a Procfile is supported/generated for dynos and the processes for each role will need to be declared.

from heroku-buildpack-crystal.

arr-dev avatar arr-dev commented on May 26, 2024

Thanks for the elaborate response :-)
Cheers

from heroku-buildpack-crystal.

Related Issues (14)

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.