I was using this code
url = "http://#{agent_host}:#{agent_port}/home/create_unit?"
And it worked fine in development but for my config.yml, I was
specifying localhost for agent_host. However in production, agent_host
is an actual ip address and it just wouldn''t work. So I had to
explicitly put the ip address in production:
url = "http://xxx.xxx.xx.xxx/home/create_unit?"
This is what that config file had:
agent_development:
host: localhost
port: 3001
agent_production:
host: xxx.xxx.xx.xxx
port: 80
agent_staging:
host: xxx.xxx.xx.xxx
port: 80
where the x''s are replaced with actual numeric values that represent
ip address.
How does the yaml interpret that ip address? As a decimal value? I''m
not sure why when I substitute it into the string interpolation, that
it doesn''t in production.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/a2164b5e-4180-4f74-aa06-0f6ecd8ffef8%40w15g2000vbn.googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Intepreted as String. Look at my irb session (I''ve put 200.200.200.200
for testing purposes).
Try logging what the string looks like after interpolation.
1.9.3p429 :020 > y = <<EOF
1.9.3p429 :021"> agent_development:
1.9.3p429 :022"> host: localhost
1.9.3p429 :023"> port: 3001
1.9.3p429 :024"> agent_production:
1.9.3p429 :025"> host: 200.200.20.200
1.9.3p429 :026"> port: 80
1.9.3p429 :027"> agent_staging:
1.9.3p429 :028"> host: 200.200.200.200
1.9.3p429 :029"> port: 80
1.9.3p429 :030"> EOF
=> "agent_development:\n host: localhost\n port:
3001\nagent_production:\n host: 200.200.20.200\n port:
80\nagent_staging:\n host: 200.200.200.200\n port: 80\n"
1.9.3p429 :031 > YAML.load y
=>
{"agent_development"=>{"host"=>"localhost",
"port"=>3001},
"agent_production"=>{"host"=>"200.200.20.200",
"port"=>80},
"agent_staging"=>{"host"=>"200.200.200.200",
"port"=>80}}
On Tue, May 21, 2013 at 1:27 PM, John Merlino
<stoicism1-YDxpq3io04c@public.gmane.org> wrote:> I was using this code
>
> url =
"http://#{agent_host}:#{agent_port}/home/create_unit?"
>
>
> And it worked fine in development but for my config.yml, I was
> specifying localhost for agent_host. However in production, agent_host
> is an actual ip address and it just wouldn''t work. So I had to
> explicitly put the ip address in production:
>
> url = "http://xxx.xxx.xx.xxx/home/create_unit?"
>
> This is what that config file had:
>
> agent_development:
> host: localhost
> port: 3001
> agent_production:
> host: xxx.xxx.xx.xxx
> port: 80
> agent_staging:
> host: xxx.xxx.xx.xxx
> port: 80
>
> where the x''s are replaced with actual numeric values that
represent
> ip address.
>
> How does the yaml interpret that ip address? As a decimal value?
I''m
> not sure why when I substitute it into the string interpolation, that
> it doesn''t in production.
>
> --
> You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/a2164b5e-4180-4f74-aa06-0f6ecd8ffef8%40w15g2000vbn.googlegroups.com?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/CAH_NQoNdt1H%2BLyGELWAJr3NPeQ4Fd2U0JCyaVOYxyO%2B%3D73d%3D4g%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Use " for strings if they are ambitious, "127.0.0.1" for example. Am 21.05.2013 18:27 schrieb "John Merlino" <stoicism1-YDxpq3io04c@public.gmane.org>:> I was using this code > > url = "http://#{agent_host}:#{agent_port}/home/create_unit?" > > > And it worked fine in development but for my config.yml, I was > specifying localhost for agent_host. However in production, agent_host > is an actual ip address and it just wouldn''t work. So I had to > explicitly put the ip address in production: > > url = "http://xxx.xxx.xx.xxx/home/create_unit?" > > This is what that config file had: > > agent_development: > host: localhost > port: 3001 > agent_production: > host: xxx.xxx.xx.xxx > port: 80 > agent_staging: > host: xxx.xxx.xx.xxx > port: 80 > > where the x''s are replaced with actual numeric values that represent > ip address. > > How does the yaml interpret that ip address? As a decimal value? I''m > not sure why when I substitute it into the string interpolation, that > it doesn''t in production. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/a2164b5e-4180-4f74-aa06-0f6ecd8ffef8%40w15g2000vbn.googlegroups.com?hl=en-US > . > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BbCVsu63ncpTE24AN5%3D0JvPANTFT79avC3bKszux4sqt81Uqg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
On Tue, May 21, 2013 at 11:27 AM, John Merlino <stoicism1-YDxpq3io04c@public.gmane.org> wrote:> I was using this code > > url = "http://#{agent_host}:#{agent_port}/home/create_unit?" > > > And it worked fine in development but for my config.yml, I was > specifying localhost for agent_host. However in production, agent_host > is an actual ip address and it just wouldn''t work. So I had to > explicitly put the ip address in production: > > url = "http://xxx.xxx.xx.xxx/home/create_unit?" > > This is what that config file had: > > agent_development: > host: localhost > port: 3001 > agent_production: > host: xxx.xxx.xx.xxx > port: 80 > agent_staging: > host: xxx.xxx.xx.xxx > port: 80 > > where the x''s are replaced with actual numeric values that represent > ip address. > > How does the yaml interpret that ip address? As a decimal value? I''m > not sure why when I substitute it into the string interpolation, that > it doesn''t in production.I don''t think it''s a YAML problem. Show us the code where you go from your YAML configuration to instantiating agent_host and agent_port in the url assignment: > url = "http://#{agent_host}:#{agent_port}/home/create_unit?" BTW, I think you''d might be better off constructing the url via the URI library. It makes things a bit less error prone and can do nice things like check the validity of the url syntax and such. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t-82o8aOoU6Nyo%3DcSZJL_yOXs-4JCutr0zkPA2YYkV5pg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.