{"action":"created","comment":{"url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/comments/338780650","pull_request_review_id":306849689,"id":338780650,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzODc4MDY1MA==","diff_hunk":"@@ -375,65 +333,55 @@ write-data=${ instance.path() }\\r\\n\n \t\t\"username\": config.username,\n \t\t\"token\": config.token,\n \t\t\"game_password\": config.game_password,\n-\t\t\"verify_user_identity\": config.verify_user_identity,\n-\t\t\"admins\": [config.username],\n+\t\t\"require_user_verification\": config.verify_user_identity,\n \t\t\"allow_commands\": config.allow_commands,\n \t\t\"autosave_interval\": 10,\n \t\t\"autosave_slots\": 5,\n \t\t\"afk_autokick_interval\": 0,\n \t\t\"auto_pause\": config.auto_pause,\n \t};\n-\tfs.writeFileSync(instance.path(\"server-settings.json\"), JSON.stringify(serversettings, null, 4));\n-    console.log(\"Server settings: \"+JSON.stringify(serversettings, null, 4));\n-    console.log(\"Creating save .....\");\n-    let factorio = child_process.spawn(\n-        './' + config.factorioDirectory + '/bin/x64/factorio', [\n-            '-c', instance.path(\"config.ini\"),\n-            // '--create', instance.path(\"saves\", \"save.zip\"),\n-            '--start-server-load-scenario', 'Hotpatch',\n-            '--server-settings', instance.path(\"server-settings.json\"),\n-            '--rcon-port', Number(process.env.RCONPORT) || instconf.clientPort,\n-            '--rcon-password', instconf.clientPassword,\n-        ], {\n-\t\t\t'stdio': ['pipe', 'pipe', 'pipe'],\n-\t\t\t'detached': process.platform === \"linux\",\n-        }\n-    );\n-    factorio.stdout.on(\"data\", data => {\n-        data = data.toString(\"utf8\").replace(/(\\r\\n\\t|\\n|\\r\\t)/gm,\"\");\n-        console.log(data);\n-        if(data.includes(\"Starting RCON interface\")){\n-            let client = new Rcon({\n-\t\t\t\tpacketResponseTimeout: 200000,\n-\t\t\t    maxPending: 5\n-\t\t\t});\n-            client.connect({\n-                host: 'localhost',\n-                port: Number(process.env.RCONPORT) || instconf.clientPort,\n-                password: instconf.clientPassword\n-            });\n-            client.onDidAuthenticate(() => {\n-                console.log('Clusterio | RCON Authenticated!');\n-            });\n-            client.onDidConnect(() => {\n-                console.log('Clusterio | RCON Connected, starting save');\n-                client.send(\"/c game.server_save('hotpachSave')\");\n-            });\n-        }\n-        if(data.includes(\"Saving finished\")){\n-            console.log(\"Map saved as hotpachSave.zip, exiting...\");\n-            console.log(\"Instance created!\")\n-            process.exit(0);\n-        }\n-\t\tif(data.includes(\"Downloading from auth server failed\")){\n-\t\t\tconsole.error(\"Instance creation failed, unable to establish auth server connection.\");\n-\t\t\tconsole.error(\"Deleting broken instance...\");\n-\t\t\t\n-\t\t\tfileOps.deleteFolderRecursiveSync(path.resolve(config.instanceDirectory, process.argv[3]));\n-\t\t\t\n-\t\t\tprocess.exit(0);\n+\n+\tfor (let [name, value] of Object.entries(overrides)) {\n+\t\tif (!Object.hasOwnProperty.call(serverSettings, name)) {\n+\t\t\tthrow Error(`Expected server settings to have a ${name} property`);\n \t\t}\n+\t\tserverSettings[name] = value;\n+\t}\n+\n+\tawait fs.writeFile(instance.path(\"server-settings.json\"), JSON.stringify(serverSettings, null, 4));","path":"client.js","position":326,"original_position":323,"commit_id":"c08d97e6986fc92b176a6d8efb5f393613a18244","original_commit_id":"4799221b9b10ff67c1e136166512ae9c33233ad7","user":{"login":"psihius","id":3097957,"node_id":"MDQ6VXNlcjMwOTc5NTc=","avatar_url":"https://avatars0.githubusercontent.com/u/3097957?v=4","gravatar_id":"","url":"https://api.github.com/users/psihius","html_url":"https://github.com/psihius","followers_url":"https://api.github.com/users/psihius/followers","following_url":"https://api.github.com/users/psihius/following{/other_user}","gists_url":"https://api.github.com/users/psihius/gists{/gist_id}","starred_url":"https://api.github.com/users/psihius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psihius/subscriptions","organizations_url":"https://api.github.com/users/psihius/orgs","repos_url":"https://api.github.com/users/psihius/repos","events_url":"https://api.github.com/users/psihius/events{/privacy}","received_events_url":"https://api.github.com/users/psihius/received_events","type":"User","site_admin":false},"body":"The thing is - you define the file names somewhere at the top of the file, preferably the root file and you just use that variable throughout the code. And it makes it easier to also add the ability to pass the file name as a command-line parameter. While we use instance-per-dir approach, you might want to use more than one server-settings.json file or even store them somewhere else and pass them at launch as paths.","created_at":"2019-10-24T20:39:18Z","updated_at":"2019-10-24T20:43:35Z","html_url":"https://github.com/clusterio/factorioClusterio/pull/242#discussion_r338780650","pull_request_url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/comments/338780650"},"html":{"href":"https://github.com/clusterio/factorioClusterio/pull/242#discussion_r338780650"},"pull_request":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242"}},"in_reply_to_id":331214669},"pull_request":{"url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242","id":323984643,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIzOTg0NjQz","html_url":"https://github.com/clusterio/factorioClusterio/pull/242","diff_url":"https://github.com/clusterio/factorioClusterio/pull/242.diff","patch_url":"https://github.com/clusterio/factorioClusterio/pull/242.patch","issue_url":"https://api.github.com/repos/clusterio/factorioClusterio/issues/242","number":242,"state":"open","locked":false,"title":"Rewrite factorio server spawning and communication","user":{"login":"Hornwitser","id":14362102,"node_id":"MDQ6VXNlcjE0MzYyMTAy","avatar_url":"https://avatars1.githubusercontent.com/u/14362102?v=4","gravatar_id":"","url":"https://api.github.com/users/Hornwitser","html_url":"https://github.com/Hornwitser","followers_url":"https://api.github.com/users/Hornwitser/followers","following_url":"https://api.github.com/users/Hornwitser/following{/other_user}","gists_url":"https://api.github.com/users/Hornwitser/gists{/gist_id}","starred_url":"https://api.github.com/users/Hornwitser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hornwitser/subscriptions","organizations_url":"https://api.github.com/users/Hornwitser/orgs","repos_url":"https://api.github.com/users/Hornwitser/repos","events_url":"https://api.github.com/users/Hornwitser/events{/privacy}","received_events_url":"https://api.github.com/users/Hornwitser/received_events","type":"User","site_admin":false},"body":"This is a do over of the server spawning and communication logic, the idea is to get some structure on this instead of being a complete mess in client.js.  It's partly necessary for #200 as it proved to be problematic to adopt the new configuration system with all the clutter present.  It's also a hard requirement for #201.\r\n\r\nI've not yet completed this, but I wanted to put this out in case anyone has some thoughts they would like to share on this.","created_at":"2019-10-02T23:26:38Z","updated_at":"2019-10-24T20:43:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fa3568f9fad219325a71bf358f06b683de975cb8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242/commits","review_comments_url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242/comments","review_comment_url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clusterio/factorioClusterio/issues/242/comments","statuses_url":"https://api.github.com/repos/clusterio/factorioClusterio/statuses/c08d97e6986fc92b176a6d8efb5f393613a18244","head":{"label":"Hornwitser:finish-factorio-server","ref":"finish-factorio-server","sha":"c08d97e6986fc92b176a6d8efb5f393613a18244","user":{"login":"Hornwitser","id":14362102,"node_id":"MDQ6VXNlcjE0MzYyMTAy","avatar_url":"https://avatars1.githubusercontent.com/u/14362102?v=4","gravatar_id":"","url":"https://api.github.com/users/Hornwitser","html_url":"https://github.com/Hornwitser","followers_url":"https://api.github.com/users/Hornwitser/followers","following_url":"https://api.github.com/users/Hornwitser/following{/other_user}","gists_url":"https://api.github.com/users/Hornwitser/gists{/gist_id}","starred_url":"https://api.github.com/users/Hornwitser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hornwitser/subscriptions","organizations_url":"https://api.github.com/users/Hornwitser/orgs","repos_url":"https://api.github.com/users/Hornwitser/repos","events_url":"https://api.github.com/users/Hornwitser/events{/privacy}","received_events_url":"https://api.github.com/users/Hornwitser/received_events","type":"User","site_admin":false},"repo":{"id":199050902,"node_id":"MDEwOlJlcG9zaXRvcnkxOTkwNTA5MDI=","name":"factorioClusterio","full_name":"Hornwitser/factorioClusterio","private":false,"owner":{"login":"Hornwitser","id":14362102,"node_id":"MDQ6VXNlcjE0MzYyMTAy","avatar_url":"https://avatars1.githubusercontent.com/u/14362102?v=4","gravatar_id":"","url":"https://api.github.com/users/Hornwitser","html_url":"https://github.com/Hornwitser","followers_url":"https://api.github.com/users/Hornwitser/followers","following_url":"https://api.github.com/users/Hornwitser/following{/other_user}","gists_url":"https://api.github.com/users/Hornwitser/gists{/gist_id}","starred_url":"https://api.github.com/users/Hornwitser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hornwitser/subscriptions","organizations_url":"https://api.github.com/users/Hornwitser/orgs","repos_url":"https://api.github.com/users/Hornwitser/repos","events_url":"https://api.github.com/users/Hornwitser/events{/privacy}","received_events_url":"https://api.github.com/users/Hornwitser/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Hornwitser/factorioClusterio","description":"internet communication for factorio mods","fork":true,"url":"https://api.github.com/repos/Hornwitser/factorioClusterio","forks_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/forks","keys_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/teams","hooks_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/hooks","issue_events_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/issues/events{/number}","events_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/events","assignees_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/assignees{/user}","branches_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/branches{/branch}","tags_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/tags","blobs_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/git/refs{/sha}","trees_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/statuses/{sha}","languages_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/languages","stargazers_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/stargazers","contributors_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/contributors","subscribers_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/subscribers","subscription_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/subscription","commits_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/commits{/sha}","git_commits_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/git/commits{/sha}","comments_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/comments{/number}","issue_comment_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/issues/comments{/number}","contents_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/contents/{+path}","compare_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/merges","archive_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/downloads","issues_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/issues{/number}","pulls_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/pulls{/number}","milestones_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/milestones{/number}","notifications_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/labels{/name}","releases_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/releases{/id}","deployments_url":"https://api.github.com/repos/Hornwitser/factorioClusterio/deployments","created_at":"2019-07-26T16:47:14Z","updated_at":"2019-09-11T18:49:14Z","pushed_at":"2019-10-24T13:15:33Z","git_url":"git://github.com/Hornwitser/factorioClusterio.git","ssh_url":"git@github.com:Hornwitser/factorioClusterio.git","clone_url":"https://github.com/Hornwitser/factorioClusterio.git","svn_url":"https://github.com/Hornwitser/factorioClusterio","homepage":null,"size":11614,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"horn-dev"}},"base":{"label":"clusterio:master","ref":"master","sha":"3202e2d1503c1182c6f23dc94a7a8ca8f779763f","user":{"login":"clusterio","id":54189628,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MTg5NjI4","avatar_url":"https://avatars3.githubusercontent.com/u/54189628?v=4","gravatar_id":"","url":"https://api.github.com/users/clusterio","html_url":"https://github.com/clusterio","followers_url":"https://api.github.com/users/clusterio/followers","following_url":"https://api.github.com/users/clusterio/following{/other_user}","gists_url":"https://api.github.com/users/clusterio/gists{/gist_id}","starred_url":"https://api.github.com/users/clusterio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clusterio/subscriptions","organizations_url":"https://api.github.com/users/clusterio/orgs","repos_url":"https://api.github.com/users/clusterio/repos","events_url":"https://api.github.com/users/clusterio/events{/privacy}","received_events_url":"https://api.github.com/users/clusterio/received_events","type":"Organization","site_admin":false},"repo":{"id":65576660,"node_id":"MDEwOlJlcG9zaXRvcnk2NTU3NjY2MA==","name":"factorioClusterio","full_name":"clusterio/factorioClusterio","private":false,"owner":{"login":"clusterio","id":54189628,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU0MTg5NjI4","avatar_url":"https://avatars3.githubusercontent.com/u/54189628?v=4","gravatar_id":"","url":"https://api.github.com/users/clusterio","html_url":"https://github.com/clusterio","followers_url":"https://api.github.com/users/clusterio/followers","following_url":"https://api.github.com/users/clusterio/following{/other_user}","gists_url":"https://api.github.com/users/clusterio/gists{/gist_id}","starred_url":"https://api.github.com/users/clusterio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clusterio/subscriptions","organizations_url":"https://api.github.com/users/clusterio/orgs","repos_url":"https://api.github.com/users/clusterio/repos","events_url":"https://api.github.com/users/clusterio/events{/privacy}","received_events_url":"https://api.github.com/users/clusterio/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/clusterio/factorioClusterio","description":"internet communication for factorio mods","fork":false,"url":"https://api.github.com/repos/clusterio/factorioClusterio","forks_url":"https://api.github.com/repos/clusterio/factorioClusterio/forks","keys_url":"https://api.github.com/repos/clusterio/factorioClusterio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clusterio/factorioClusterio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clusterio/factorioClusterio/teams","hooks_url":"https://api.github.com/repos/clusterio/factorioClusterio/hooks","issue_events_url":"https://api.github.com/repos/clusterio/factorioClusterio/issues/events{/number}","events_url":"https://api.github.com/repos/clusterio/factorioClusterio/events","assignees_url":"https://api.github.com/repos/clusterio/factorioClusterio/assignees{/user}","branches_url":"https://api.github.com/repos/clusterio/factorioClusterio/branches{/branch}","tags_url":"https://api.github.com/repos/clusterio/factorioClusterio/tags","blobs_url":"https://api.github.com/repos/clusterio/factorioClusterio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clusterio/factorioClusterio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clusterio/factorioClusterio/git/refs{/sha}","trees_url":"https://api.github.com/repos/clusterio/factorioClusterio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clusterio/factorioClusterio/statuses/{sha}","languages_url":"https://api.github.com/repos/clusterio/factorioClusterio/languages","stargazers_url":"https://api.github.com/repos/clusterio/factorioClusterio/stargazers","contributors_url":"https://api.github.com/repos/clusterio/factorioClusterio/contributors","subscribers_url":"https://api.github.com/repos/clusterio/factorioClusterio/subscribers","subscription_url":"https://api.github.com/repos/clusterio/factorioClusterio/subscription","commits_url":"https://api.github.com/repos/clusterio/factorioClusterio/commits{/sha}","git_commits_url":"https://api.github.com/repos/clusterio/factorioClusterio/git/commits{/sha}","comments_url":"https://api.github.com/repos/clusterio/factorioClusterio/comments{/number}","issue_comment_url":"https://api.github.com/repos/clusterio/factorioClusterio/issues/comments{/number}","contents_url":"https://api.github.com/repos/clusterio/factorioClusterio/contents/{+path}","compare_url":"https://api.github.com/repos/clusterio/factorioClusterio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clusterio/factorioClusterio/merges","archive_url":"https://api.github.com/repos/clusterio/factorioClusterio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clusterio/factorioClusterio/downloads","issues_url":"https://api.github.com/repos/clusterio/factorioClusterio/issues{/number}","pulls_url":"https://api.github.com/repos/clusterio/factorioClusterio/pulls{/number}","milestones_url":"https://api.github.com/repos/clusterio/factorioClusterio/milestones{/number}","notifications_url":"https://api.github.com/repos/clusterio/factorioClusterio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clusterio/factorioClusterio/labels{/name}","releases_url":"https://api.github.com/repos/clusterio/factorioClusterio/releases{/id}","deployments_url":"https://api.github.com/repos/clusterio/factorioClusterio/deployments","created_at":"2016-08-12T18:54:04Z","updated_at":"2019-10-22T14:09:49Z","pushed_at":"2019-10-24T13:15:35Z","git_url":"git://github.com/clusterio/factorioClusterio.git","ssh_url":"git@github.com:clusterio/factorioClusterio.git","clone_url":"https://github.com/clusterio/factorioClusterio.git","svn_url":"https://github.com/clusterio/factorioClusterio","homepage":null,"size":11592,"stargazers_count":112,"watchers_count":112,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":39,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":17,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":39,"open_issues":17,"watchers":112,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242"},"html":{"href":"https://github.com/clusterio/factorioClusterio/pull/242"},"issue":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/issues/242"},"comments":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242/comments"},"review_comment":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/pulls/242/commits"},"statuses":{"href":"https://api.github.com/repos/clusterio/factorioClusterio/statuses/c08d97e6986fc92b176a6d8efb5f393613a18244"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"psihius"}}