Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Allow the option to use another yml file #93

Open
vandamon opened this issue Jan 25, 2014 · 4 comments
Open

Allow the option to use another yml file #93

vandamon opened this issue Jan 25, 2014 · 4 comments

Comments

@vandamon
Copy link

I was trying to test my app over LAN, but I am unable to run private_pub both on local machine and host machine with different configuration. Because it always uses the private_pub.yml file. Would be great if I can use another file such private_pub_on_lan.yml.

@coorasse
Copy link

Can't you just edit the file? o_0

Alessandro Rodi

On Sat, Jan 25, 2014 at 11:57 AM, vandamon notifications@github.com wrote:

I was trying to test my app over LAN, but I am unable to run private_pub
both on local machine and host machine with different configuration.
Because it always uses the private_pub.yml file. Would be great if I can
use another file such private_pub_on_lan.yml.


Reply to this email directly or view it on GitHubhttps://github.com//issues/93
.

@gregmolnar
Copy link

You can use any config file you want. Just load the appropriate config in private_pub.ru by setting some condition:

if lan? # check here if your app is on lan.
  PrivatePub.load_config(File.expand_path("../config/private_pub_lan.yml", __FILE__), ENV["RAILS_ENV"] || "development")
else
  PrivatePub.load_config(File.expand_path("../config/private_pub.yml", __FILE__), ENV["RAILS_ENV"] || "development")
end
run PrivatePub.faye_app

@vandamon
Copy link
Author

@gregmolnar Even if I change this line

PrivatePub.load_config(File.expand_path("../config/private_pub.yml", __FILE__), ENV["RAILS_ENV"] || "development")

to (without any conditions)

PrivatePub.load_config(File.expand_path("../config/private_pub_lan.yml", __FILE__), ENV["RAILS_ENV"] || "development")

it still picks up the config from private_pub.yml, as long as the file is there. Because of this:

path = Rails.root.join("config/private_pub.yml")

Also, if you know, please let me know how to pass a dynamic variable to a rackup file. I don't see any option for that.

@gregmolnar
Copy link

Well spotted. I didn't now about that part. The issue is this repo is abandoned by Ryan. Otherwise it would be a quick fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants