add setup.js and add getRecord, getRecords, fix api logs
parent
6e0d4164c1
commit
24ff180ea6
@ -0,0 +1,24 @@
|
|||||||
|
import {JsonDataStore} from './JsonDataStore.js';
|
||||||
|
import {OvhApi} from "./OvhApi.js";
|
||||||
|
|
||||||
|
let store = new JsonDataStore('config.json').getSyncedData();
|
||||||
|
|
||||||
|
if (!store.ovhCredentials){
|
||||||
|
console.log('ovhCredentials are undefined!');
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
if (!store.ovhCredentials.applicationKey || !store.ovhCredentials.applicationSecret){
|
||||||
|
console.log('applicationKey and/or applicationSecret are missing');
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
let dns = new OvhApi({credentials: store.ovhCredentials, logs: false});
|
||||||
|
|
||||||
|
if (!store.ovhCredentials.consumerKey) await dns.getConsumerKey();
|
||||||
|
|
||||||
|
console.log('list all available records for defined domains =>');
|
||||||
|
Object.keys(store.records).forEach(domain => {
|
||||||
|
dns.getRecords({domain}).then(ids => ids.forEach(id => {
|
||||||
|
dns.getRecord({domain, id}).then(console.log);
|
||||||
|
}));
|
||||||
|
});
|
Loading…
Reference in New Issue