NAME

DDG::Rewrite - A (mostly spice related) Rewrite definition in our system

VERSION

version 1018

SYNOPSIS

my $rewrite = DDG::Rewrite->new(
  path => '/js/test/',
  to => 'http://some.api/$1',
);

print $rewrite->nginx_conf;

# location ^~ /js/test/ {
#   rewrite ^/js/test/(.*) /$1 break;
#   proxy_pass http://some.api:80/;
# }

my $missing_rewrite = DDG::Rewrite->new(
  path => '/js/test/',
  to => 'http://some.api/$1/?key={{ENV{DDGTEST_DDG_REWRITE_TEST_API_KEY}}}',
);

if ($missing_rewrite->missing_envs) { ... }

# is false if $ENV{DDGTEST_DDG_REWRITE_TEST_API_KEY} is not set

DESCRIPTION

This class is used to contain a definition for a rewrite in our system. So far its specific designed for the problems we face towards spice redirects, but the definition is used in the App::DuckPAN test server. In the production system we use those definitions to generate an nginx config.

AUTHOR

DuckDuckGo <open@duckduckgo.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by DuckDuckGo, Inc. https://duckduckgo.com/.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004