Comments (12)
The port should be coming from ENV, I believe. Is it not working for you?
from heroku-buildpack-crystal.
@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.
@arr-dev Does that answer your question? Can we close this?
from heroku-buildpack-crystal.
That wasn't clear by looking at the docs, but yes, sure, can be closed.
from heroku-buildpack-crystal.
@bcardiff Maybe we can add something on the README in this regard. What do you think?
from heroku-buildpack-crystal.
@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.
@arr-dev Do you want to take a stab at it?
from heroku-buildpack-crystal.
@zamith Sure, I'll give it a go.
from heroku-buildpack-crystal.
Awesome. Thanks a lot.
from heroku-buildpack-crystal.
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.
- I think it is more common to pass options in CLI than in ENV.
- The
--port $PORT
was already there :-) - 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.
Thanks for the elaborate response :-)
Cheers
from heroku-buildpack-crystal.
Related Issues (14)
- Deprecation warning HOT 3
- Non-web apps HOT 3
- Change app executable to allow app folder HOT 3
- old version HOT 3
- LLVM 3.5 HOT 9
- Broken for 0.23.1 HOT 9
- Change compile script to support tags in crystal with v prefix
- Register with Buildpack Registry HOT 1
- Unable to deploy app with dash in name (.cr does not exist) HOT 6
- App builds fine locally, fails to build on heroku server HOT 1
- Unable to build Crystal 0.33 HOT 3
- Add support for ENV_DIR
- Heroku Deployment fails, gmp needed HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heroku-buildpack-crystal.