diff --git a/.env b/.env index 2d3022a..65e8a5b 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ CONTAINER_PORT=9088 UID=1000 CI_ENV=development +API_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com" # $arr["host"] = "10.10.10.23"; # $arr["name"] = "wrenchboard"; # $arr["user"] = "wrenchboard"; diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..65e8a5b --- /dev/null +++ b/.env.development @@ -0,0 +1,80 @@ +CONTAINER_PORT=9088 +UID=1000 +CI_ENV=development +API_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com" +# $arr["host"] = "10.10.10.23"; +# $arr["name"] = "wrenchboard"; +# $arr["user"] = "wrenchboard"; +# $arr["pass"] = "wrenchboard"; +# $arr["port"] = 5432; + + +#-------------------------------------------------------------------- +# Example Environment Configuration file +# +# This file can be used as a starting point for your own +# custom .env files, and contains most of the possible settings +# available in a default install. +# +# By default, all of the settings are commented out. If you want +# to override the setting, you must un-comment it by removing the '#' +# at the beginning of the line. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# ENVIRONMENT +#-------------------------------------------------------------------- + +# CI_ENVIRONMENT = production + +#-------------------------------------------------------------------- +# APP +#-------------------------------------------------------------------- + +# app.baseURL = '' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' +# app.forceGlobalSecureRequests = false +# app.CSPEnabled = false + +#-------------------------------------------------------------------- +# DATABASE +#-------------------------------------------------------------------- + +# database.default.hostname = localhost +# database.default.database = ci4 +# database.default.username = root +# database.default.password = root +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.port = 3306 + +# If you use MySQLi as tests, first update the values of Config\Database::$tests. +# database.tests.hostname = localhost +# database.tests.database = ci4_test +# database.tests.username = root +# database.tests.password = root +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.charset = utf8mb4 +# database.tests.DBCollat = utf8mb4_general_ci +# database.tests.port = 3306 + +#-------------------------------------------------------------------- +# ENCRYPTION +#-------------------------------------------------------------------- + +# encryption.key = + +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.savePath = null + +#-------------------------------------------------------------------- +# LOGGER +#-------------------------------------------------------------------- + +# logger.threshold = 4 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..977fe8b --- /dev/null +++ b/.env.production @@ -0,0 +1,80 @@ +CONTAINER_PORT=9088 +UID=1000 +CI_ENV=development +API_ENDPOINT="https://apigate.orion.g1.wrenchboard.com" +# $arr["host"] = "10.10.10.23"; +# $arr["name"] = "wrenchboard"; +# $arr["user"] = "wrenchboard"; +# $arr["pass"] = "wrenchboard"; +# $arr["port"] = 5432; + + +#-------------------------------------------------------------------- +# Example Environment Configuration file +# +# This file can be used as a starting point for your own +# custom .env files, and contains most of the possible settings +# available in a default install. +# +# By default, all of the settings are commented out. If you want +# to override the setting, you must un-comment it by removing the '#' +# at the beginning of the line. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# ENVIRONMENT +#-------------------------------------------------------------------- + +# CI_ENVIRONMENT = production + +#-------------------------------------------------------------------- +# APP +#-------------------------------------------------------------------- + +# app.baseURL = '' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' +# app.forceGlobalSecureRequests = false +# app.CSPEnabled = false + +#-------------------------------------------------------------------- +# DATABASE +#-------------------------------------------------------------------- + +# database.default.hostname = localhost +# database.default.database = ci4 +# database.default.username = root +# database.default.password = root +# database.default.DBDriver = MySQLi +# database.default.DBPrefix = +# database.default.port = 3306 + +# If you use MySQLi as tests, first update the values of Config\Database::$tests. +# database.tests.hostname = localhost +# database.tests.database = ci4_test +# database.tests.username = root +# database.tests.password = root +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.charset = utf8mb4 +# database.tests.DBCollat = utf8mb4_general_ci +# database.tests.port = 3306 + +#-------------------------------------------------------------------- +# ENCRYPTION +#-------------------------------------------------------------------- + +# encryption.key = + +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.savePath = null + +#-------------------------------------------------------------------- +# LOGGER +#-------------------------------------------------------------------- + +# logger.threshold = 4 diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 7c3213d..22c0a0f 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -102,4 +102,8 @@ abstract class BaseController extends Controller curl_close($curl); return json_decode($result, true); } + + public function wrenchApiServer():string{ + return getenv("API_ENDPOINT")."/en/promo/api/v1/"; + } } diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 3a64a1f..2005fb8 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -14,10 +14,11 @@ class Home extends BaseController // echo $promoOwner; //http://10.204.5.100:9083/en/promo/api/v1/start + // echo $backend_server = getenv("API_ENDPOINT"); $in["promo"] = $promo; $in["promo_owner"] = $promoOwner; - $out = $this->APIcall('POST','http://10.204.5.100:9083/en/promo/api/v1/start',[]); + $out = $this->APIcall('POST', $this->wrenchApiServer(). 'start',[]); //var_dump($out); return view('welcome_message', $out); }