mirror of
https://github.com/jung-geun/DynamicDNS-SSL.git
synced 2025-12-19 20:44:40 +09:00
Refactor sonar-project.properties to include SonarQube in gitignore
This commit is contained in:
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,sonarqube
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode,sonarqube
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
@@ -173,6 +173,19 @@ poetry.toml
|
||||
# LSP config files
|
||||
pyrightconfig.json
|
||||
|
||||
### SonarQube ###
|
||||
# SonarQube ignore files.
|
||||
#
|
||||
# https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner
|
||||
# Sonar Scanner working directories
|
||||
.sonar/
|
||||
.sonarqube/
|
||||
.scannerwork/
|
||||
|
||||
# http://www.sonarlint.org/commandline/
|
||||
# SonarLint working directories, configuration files (including credentials)
|
||||
.sonarlint/
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/
|
||||
|
||||
@@ -187,4 +200,4 @@ pyrightconfig.json
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
|
||||
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode,sonarqube
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
This project aims to implement a Dynamic DNS (DDNS) solution using Cloudflare's API.
|
||||
|
||||
[](https://sonar.pieroot.xyz/dashboard?id=pieroot_cloudflare-ddns_e6da100b-a671-4736-87ac-9a41acda99f6)
|
||||
[](https://sonar.pieroot.xyz/dashboard?id=jung-geun_cloudflare-ddns_AZIjf9NeRMPvGKjJzls4)
|
||||
[](https://sonar.pieroot.xyz/dashboard?id=jung-geun_cloudflare-ddns_AZIjf9NeRMPvGKjJzls4)
|
||||
[](https://sonar.pieroot.xyz/dashboard?id=jung-geun_cloudflare-ddns_AZIjf9NeRMPvGKjJzls4)
|
||||
|
||||
## Overview
|
||||
Dynamic DNS allows you to associate a domain name with a changing IP address, making it easier to access your network resources remotely. Cloudflare's API provides the necessary tools to automate this process.
|
||||
|
||||
@@ -22,6 +22,8 @@ logger.addHandler(fileHandler)
|
||||
logger.addHandler(logging.StreamHandler())
|
||||
|
||||
DEFAULT_CONFIG_PATH = os.path.join(os.path.dirname(__file__), "../config/env.json")
|
||||
PWD = os.path.dirname(os.path.abspath(__file__))
|
||||
TMP_PATH = os.path.join(PWD, "tmp")
|
||||
|
||||
|
||||
class DDNS:
|
||||
@@ -34,6 +36,7 @@ class DDNS:
|
||||
logger.info(f"Previous IP: {previous_ip}")
|
||||
self.current_ip = current_ip
|
||||
self.cname_list = self.config["CLOUDFLARE_CNAME"]
|
||||
self.external_ip_path = os.path.join(TMP_PATH, "external_ip.txt")
|
||||
|
||||
self.HEADERS = {
|
||||
"Content-Type": "application/json",
|
||||
@@ -105,11 +108,11 @@ class DDNS:
|
||||
|
||||
def previous_ip(self):
|
||||
try:
|
||||
if os.path.exists("/tmp/external_ip.txt"):
|
||||
with open("/tmp/external_ip.txt", "r") as file:
|
||||
if os.path.exists(self.external_ip_path):
|
||||
with open(self.external_ip_path, "r") as file:
|
||||
return file.read()
|
||||
else:
|
||||
os.mknod("/tmp/external_ip.txt")
|
||||
os.mknod(self.external_ip_path)
|
||||
except Exception as e:
|
||||
logger.error(f"Error: {e}")
|
||||
return None
|
||||
@@ -127,7 +130,7 @@ class DDNS:
|
||||
|
||||
def update_ip(self, ip):
|
||||
try:
|
||||
with open("/tmp/external_ip.txt", "w") as file:
|
||||
with open(self.external_ip_path, "w") as file:
|
||||
file.write(ip)
|
||||
logger.info("IP is updated")
|
||||
except Exception as e:
|
||||
|
||||
0
tmp/.gitkeep
Normal file
0
tmp/.gitkeep
Normal file
Reference in New Issue
Block a user