Skip to content

Commit

Permalink
Update to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicSaladin committed Jun 29, 2024
1 parent 77ff2c7 commit f84a4ad
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>DSaladin.CloudflareDNSUpdater</PackageId>
Expand All @@ -12,6 +12,7 @@
<Product>DSaladin.CloudflareDNSUpdater</Product>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Description>Updated all dns records with type A in a specific zone</Description>
<Version>1.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down
6 changes: 6 additions & 0 deletions CloudflareDNSUpdater/CloudflareDNSUpdater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
using System.Text;
using System.Text.Json.Nodes;


string basePath = args[0];
string configFile = Path.Combine(basePath, "cloudflare.config");
string logFilePath = Path.Combine(basePath, "cloudflare.log");

// if log file is from previous day, delete it
FileInfo logFileInfo = new(logFilePath);
if (logFileInfo.CreationTime < DateTime.Today)
logFileInfo.Delete();

Logger.LogInfo(logFilePath, "Starting updating DNS records with the current ip");

if (!File.Exists(configFile))
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# cloudflare-dns-updater

# Cloudflare DNS Updater
## Usage
Download the latest release and extract it. Use for example the task scheduler to run the CloudflareDNSUpdater.exe every few minutes with the first argument being your extracted folder containing the exe, dll, runtimeconfig and your cloudflare config.
Configure the cloudflare.config with a BearerToken and the zones you would like to update ([Generate Token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/)) and make sure, the token has access to all zones.

## Supported Platforms
The project is build with .NET 8, so every platform should be supported.

- Windows
- MacOS
- Linux

0 comments on commit f84a4ad

Please sign in to comment.