Last active
August 29, 2015 14:15
-
-
Save bsenduran/0ad274498d3dad06ccdf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
var carbon = require('carbon'); | |
var server = new carbon.server.Server(); | |
var options = {system: true, domain: carbon.server.tenantDomain() , tenantId: carbon.server.tenantId()}; | |
var dataStore = new carbon.registry.Registry(server, options); | |
var res; | |
var mycontent; | |
var path = "/_system/governance/sen/hello"; | |
try { | |
res = dataStore.get(path); | |
mycontent = res.content; | |
var log = new Log(); | |
mycontent = JSON.parse(mycontent); | |
log.info(mycontent); | |
log.info(mycontent.a); | |
print(typeof mycontent); | |
mycontent["c"] = {c1:"1", c2:"2"}; | |
mycontent["d"] = {d1:"1", d2:"2"}; | |
//delete mycontent['d']; | |
var content = JSON.stringify(mycontent); | |
log.info("content is " + content); | |
res.content = content; | |
dataStore.put(path, res); | |
} catch (error) { | |
print(error); | |
print("<br/>"); | |
print('Adding new hello file'); | |
var reg_initial_js = { | |
a: { | |
a1: "1", | |
a2: "2" | |
}, | |
b: { | |
b1: "1", | |
b2: "2" | |
} | |
}; | |
resource = { | |
content: JSON.stringify(reg_initial_js) | |
}; | |
dataStore.put(path, resource); | |
} | |
var regResource = dataStore.get(path); | |
print("=============="); | |
print("<br/>"); | |
print(regResource.content); | |
print("<br/>"); | |
print("=============="); | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment