diff --git a/app.py b/app.py new file mode 100755 index 0000000..6c344db --- /dev/null +++ b/app.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +from flask import Flask + +app = Flask('dns-updater') + +@app.route('/api/dnsupdate') +def api_root(): + return "Welcome to the DNS Updater API" + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=8080) diff --git a/dns-updater.py b/dns-updater.py deleted file mode 100755 index a94bc27..0000000 --- a/dns-updater.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -import http.server -import argparse - -class DNSUpdateHandler(http.server.BaseHTTPRequestHandler): - def do_GET(self): - self.send_response(200) - self.send_header('Content-type', 'text/plain') - self.end_headers() - self.wfile.write(b'DNS Update Service is running.\n') - -def run(server_class=http.server.HTTPServer, handler_class=DNSUpdateHandler, address='127.0.0.1', port=8080): - server_address = (address, port) - httpd = server_class(server_address, handler_class) - print(f'Starting DNS Update Service on {address}:{port}...') - httpd.serve_forever() - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Run the DNS Update Service.') - parser.add_argument('--port', type=int, default=8080, help='Port to run the server on') - parser.add_argument('--address', type=str, default='127.0.0.1', help='IP address to listen on (not used in this simple example)') - args = parser.parse_args() - - try: - run(address=args.address, port=args.port) - except KeyboardInterrupt: - print("\nShutting down DNS Update Service.") -