<commit_before>console.log("process.env.TOKEN", process.env.TOKEN);
console.log("process.env.NAME", process.env.NAME);

process.env.NODE_ENV_COZYHACK = "development"

var ghost = require('./server/ghost/core/index');
var path = require('path');
var importer = require(path.join(__dirname,'./server/ghost/core/server/data/importer/index'));
var cozydb = require('cozydb');
var Blog = require('./server/models/blog');
var CozyInstance = require('./server/models/instance');
var models = require(path.join(__dirname,'./server/ghost/core/server/models/index'));
var saveListener = require('./server/ghost_hacking/save_listener');

var initial_datum = require('./server/ghost_hacking/initial_datum');

var ghostConfig = require('./server/ghost/config.js');

cozydb.configure(__dirname, null, function(){

  CozyInstance.getDomain(function(err, domain){
    if(err) {
      console.log(err)
      return
    }

    console.log("domain : ", domain);
    // ghostConfig.production.url = require('url').resolve(domain, '/public/blog/');
    ghostConfig.development.url = require('url').resolve(domain, '/public/blog/');

    ghost().then(function(ghostServer) {
      console.log("ghost.then()");
      models.deleteAllContent().then(function(){ //delete old blog post to avoid duplicate entries
        Blog.request("all", {}, function(err, blog) {
           if(err !== null) {
            console.log(err);
           } else {
              if (blog.length > 0) {
                console.log("importing...");
                importer.doImport.bind(importer)({data : blog[0].content.db[0]});
                console.log("importing...done");
              }else {
                importer.doImport.bind(importer)({data : initial_datum.db[0]});<commit_msg>fix domain with the protocol<commit_after>console.log("process.env.TOKEN", process.env.TOKEN);
console.log("process.env.NAME", process.env.NAME);

process.env.NODE_ENV_COZYHACK = "development"

var ghost = require('./server/ghost/core/index');
var path = require('path');
var importer = require(path.join(__dirname,'./server/ghost/core/server/data/importer/index'));
var cozydb = require('cozydb');
var Blog = require('./server/models/blog');
var CozyInstance = require('./server/models/instance');
var models = require(path.join(__dirname,'./server/ghost/core/server/models/index'));
var saveListener = require('./server/ghost_hacking/save_listener');

var initial_datum = require('./server/ghost_hacking/initial_datum');

var ghostConfig = require('./server/ghost/config.js');

cozydb.configure(__dirname, null, function(){

  CozyInstance.getDomain(function(err, domain){
    if(err) {
      console.log(err)
      return
    }

    console.log("domain : ", domain);
    domain = "https://" + domain;
    // ghostConfig.production.url = require('url').resolve(domain, '/public/blog/');
    ghostConfig.development.url = require('url').resolve(domain, '/public/blog/');

    ghost().then(function(ghostServer) {
      console.log("ghost.then()");
      models.deleteAllContent().then(function(){ //delete old blog post to avoid duplicate entries
        Blog.request("all", {}, function(err, blog) {
           if(err !== null) {
            console.log(err);
           } else {
              if (blog.length > 0) {
                console.log("importing...");
                importer.doImport.bind(importer)({data : blog[0].content.db[0]});
                console.log("importing...done");
              }else {
                importer.doImport.bind(importer)({data : initial_datum.db[0]});
{'fraction_non_alphanumeric': 0.1755574372001129, 'fraction_numerical': 0.0022579734688117415, 'mean_word_length': 3.3538083538083536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1236880', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1059, 'n_words': 166}