create Credentials class to specify all credentials there.
This commit is contained in:
		@@ -14,6 +14,7 @@
 | 
			
		||||
#include <Logger.h>
 | 
			
		||||
 | 
			
		||||
#include <IPRefresher.h>
 | 
			
		||||
#include <Credentials.h>
 | 
			
		||||
 | 
			
		||||
void IPRefresher::checkIPAdress(bool force) {
 | 
			
		||||
    FileLogger logger;
 | 
			
		||||
@@ -36,10 +37,11 @@ void IPRefresher::checkIPAdress(bool force) {
 | 
			
		||||
            Logger::message("ip changed! -- from :" + oldip + "to: " + ip);
 | 
			
		||||
 | 
			
		||||
            DynuAPI dynu;
 | 
			
		||||
            dynu.init(Credentials::dynuapikey,Credentials::domainid,Credentials::domainname);
 | 
			
		||||
 | 
			
		||||
            if (dynu.refreshIp(ip)) {
 | 
			
		||||
                TelegramAPI tele;
 | 
			
		||||
                tele.init("717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4", "618154204");
 | 
			
		||||
                tele.init(Credentials::telegramApiKey, Credentials::chatId);
 | 
			
		||||
                tele.sendMessage(oldip + " moved to " + ip);
 | 
			
		||||
            } else {
 | 
			
		||||
                //error
 | 
			
		||||
 
 | 
			
		||||
@@ -25,3 +25,9 @@ int DynuAPI::refreshIp(std:: string ip) {
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DynuAPI::init(std::string dynuApiKey, std::string domainId, std::string domainName) {
 | 
			
		||||
    this->dynuapikey=dynuApiKey;
 | 
			
		||||
    this->domainid=domainId;
 | 
			
		||||
    this->domainname=domainName;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,10 @@
 | 
			
		||||
#include <IPRefresher.h>
 | 
			
		||||
#include <Version.h>
 | 
			
		||||
#include <Logger.h>
 | 
			
		||||
#include <Credentials.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[]) {
 | 
			
		||||
    if(!Credentials::checkCredentialValidity()) return -1;
 | 
			
		||||
    if (argc > 1) {
 | 
			
		||||
        std::string firstarg(argv[1]);
 | 
			
		||||
        if (firstarg == "-h" || firstarg == "--help") {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user