gbetous
gbetous

Reputation: 145

In Sinatra, what is the difference between production and development environment?

I can't find an exhaustive answer.

What happens if I set "production"? I saw that view files are not read "on the fly" anymore, but are there other differences?

Upvotes: 5

Views: 632

Answers (1)

gcstr
gcstr

Reputation: 1527

Basically, only templates are affected by the env var.

You are free to implement every other application logic methods based on current env:

  if settings.production?
    # this will only run in production
  else
    # every other env
  end

You can also do something like this when need conditional configs:

configure :production, :development do
  enable :logging
end

Upvotes: 2

Related Questions