test-client-godot/assets/Scripts/Config/connexion.gd

49 lines
No EOL
2.1 KiB
GDScript

# Manage configuration to connect on khaganat
#
# Copyright (C) 2019 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class connexion:
var _url_login = ""
var _url_register = ""
var _valid_certificate = true
func _init():
print("Load connexion config");
#var message = load("res://assets/Scripts/Models/nel_login_message.gd")
var config_file = ConfigFile.new()
# /home/<account>/.local/share/godot/app_userdata/Khanat/connexion.cfg
var err = config_file.load("user://connexion.cfg")
if err:
print("Error code when loading player config file khanat.cfg: ", err)
config_file.set_value("login", "url", "http://149.91.80.160/login/r2_login.php")
config_file.set_value("register", "url", "http://149.91.80.160/ams/index.php?page=register")
config_file.set_value("global", "valid_certificate", false)
config_file.save("user://connexion.cfg")
self._url_login = config_file.get_value( "login", "url", "http://172.17.0.3/login/r2_login.php")
self._url_register = config_file.get_value( "register", "url", "http://172.17.0.3/login/r2_login.php")
self._valid_certificate = config_file.get_value( "global", "valid_certificate", false)
config_file.save("user://connexion.cfg")
func get_url_login():
return self._url_login
func get_url_register():
return self._url_register
func get_valid_certificate():
return self._valid_certificate