diff --git a/bin/swift-proxy-server b/bin/swift-proxy-server index d1d19677ef..0ba14e2357 100755 --- a/bin/swift-proxy-server +++ b/bin/swift-proxy-server @@ -30,10 +30,15 @@ if __name__ == '__main__': print "Unable to read config file." sys.exit(1) conf = dict(c.items('proxy-server')) + if c.has_section('auth-server'): + auth_conf = dict(c.items('auth-server')) + else: + auth_conf = {} swift_dir = conf.get('swift_dir', '/etc/swift') - c = ConfigParser() - c.read(os.path.join(swift_dir, 'auth-server.conf')) - auth_conf = dict(c.items('auth-server')) + m, c = auth_conf.get('class', + 'swift.common.auth.DevAuthMiddleware').rsplit('.', 1) + m = __import__(m, fromlist=[c]) + authware = m.__dict__[c] memcache = MemcacheRing([s.strip() for s in conf.get('memcache_servers', '127.0.0.1:11211').split(',') @@ -41,5 +46,5 @@ if __name__ == '__main__': logger = get_logger(conf, 'proxy') app = Application(conf, memcache, logger) # Wrap the app with auth - app = DevAuthMiddleware(app, auth_conf, memcache, logger) + app = authware(app, auth_conf, memcache, logger) run_wsgi(app, conf, logger=logger, default_port=80) diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample index 7b9fb99d74..b938e5fdec 100644 --- a/etc/proxy-server.conf-sample +++ b/etc/proxy-server.conf-sample @@ -33,3 +33,9 @@ # rate_limit_account_whitelist = acct1,acct2,etc # rate_limit_account_blacklist = acct3,acct4,etc # container_put_lock_timeout = 5 + +# [auth-server] +# class = swift.common.auth.DevAuthMiddleware +# ip = 127.0.0.1 +# port = 11000 +# node_timeout = 10 diff --git a/swift/common/auth.py b/swift/common/auth.py index 1e7be05da3..6e70f29b31 100644 --- a/swift/common/auth.py +++ b/swift/common/auth.py @@ -34,8 +34,8 @@ class DevAuthMiddleware(object): self.memcache_client = memcache_client self.logger = logger self.conf = conf - self.auth_host = conf.get('bind_ip', '127.0.0.1') - self.auth_port = int(conf.get('bind_port', 11000)) + self.auth_host = conf.get('ip', '127.0.0.1') + self.auth_port = int(conf.get('port', 11000)) self.timeout = int(conf.get('node_timeout', 10)) def __call__(self, env, start_response):