user  nginx;
worker_processes  1;

error_log /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log main;

    sendfile        on;

    keepalive_timeout  65;

    include /etc/nginx/conf.d/*.conf;
}

# Setup TCP proxies
stream {
  # Malevolent proxy
  server {
    listen     6666;
    proxy_pass malevolent:6666;
  }

  # Registry configured for token server
  server {
    listen     5554;
    listen     5555;
    proxy_pass registryv2token:5000;
  }

  # Token server
  server {
    listen     5556;
    proxy_pass tokenserver:5556;
  }

  # Registry configured for token server with oauth
  server {
    listen     5557;
    listen     5558;
    proxy_pass registryv2tokenoauth:5000;
  }

  # Token server with oauth
  server {
    listen     5559;
    proxy_pass tokenserveroauth:5559;
  }
}
