Newer
Older
smart-home-server / server / console.php
<?php

require_once __DIR__ . "/vendor/autoload.php";
include_once "Fury/fury.php";
$app = fury_init("SHServ");

function console() {
	global $argv;

	switch($argv[1]) {
		case "get.config":
			$config = FCONF;
			unset($config['db']['password']);
			unset($config['db']['user']);
			echo json_encode($config);
		break;
		case "run-regular-script":
			if(!isset($argv[2])) {
				echo "No alias provided\n";
				exit(1);
			}
			$alias = $argv[2];
			$result = \SHServ\Middleware\ControlScripts::run_regular_script($alias);
			if(!$result) {
				exit(1);
			}
		break;
		default: echo "\nNo command";
	}

	echo "\n";
}

console();