Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mapserver_mod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Minetest
mapserver_mod
Commits
06a979f0
Commit
06a979f0
authored
Aug 26, 2019
by
NatureFreshMilk
Browse files
Options
Downloads
Patches
Plain Diff
read key and url from mapserver.json (fixes
https://github.com/minetest-tools/mapserver/issues/55
)
parent
3d8e2616
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
init.lua
+25
-0
25 additions, 0 deletions
init.lua
with
25 additions
and
0 deletions
init.lua
+
25
−
0
View file @
06a979f0
...
@@ -20,9 +20,34 @@ dofile(MP.."/privs.lua")
...
@@ -20,9 +20,34 @@ dofile(MP.."/privs.lua")
local
http
=
minetest
.
request_http_api
()
local
http
=
minetest
.
request_http_api
()
if
http
then
if
http
then
-- check if the mapserver.json is in the world-folder
local
path
=
minetest
.
get_worldpath
()
..
"/mapserver.json"
;
local
mapserver_cfg
local
file
=
io.open
(
path
,
"r"
);
if
file
then
local
json
=
file
:
read
(
"*all"
);
mapserver_cfg
=
minetest
.
parse_json
(
json
);
file
:
close
();
print
(
"[Mapserver] read settings from 'mapserver.json'"
)
end
print
(
dump
(
mapserver_cfg
))
local
mapserver_url
=
minetest
.
settings
:
get
(
"mapserver.url"
)
local
mapserver_url
=
minetest
.
settings
:
get
(
"mapserver.url"
)
local
mapserver_key
=
minetest
.
settings
:
get
(
"mapserver.key"
)
local
mapserver_key
=
minetest
.
settings
:
get
(
"mapserver.key"
)
if
mapserver_cfg
and
mapserver_cfg
.
webapi
then
if
not
mapserver_key
then
-- apply key from json
mapserver_key
=
mapserver_cfg
.
webapi
.
secretkey
end
if
not
mapserver_url
then
-- assemble url from json
mapserver_url
=
"http://127.0.0.1:"
..
mapserver_cfg
.
port
end
end
if
not
mapserver_url
then
error
(
"mapserver.url is not defined"
)
end
if
not
mapserver_url
then
error
(
"mapserver.url is not defined"
)
end
if
not
mapserver_key
then
error
(
"mapserver.key is not defined"
)
end
if
not
mapserver_key
then
error
(
"mapserver.key is not defined"
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment