Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fcdb.rst update #2036

Merged
merged 4 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/CPackConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if(UNIX AND NOT APPLE)
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)
set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "ON")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "fonts-linuxlibertine (>= 5.3.0)")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "fonts-linuxlibertine (>= 5.3.0), lua (>= 5.3.0)")
jwrober marked this conversation as resolved.
Show resolved Hide resolved

endif()

Expand Down
24 changes: 15 additions & 9 deletions docs/Manuals/Server/fcdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Authentication and Database Support (fcdb)
******************************************

The Freeciv21 server allows the authentication of users, although by default it is not configured, and anyone
can connect with any username.
The Freeciv21 server allows for the authentication of users, although by default it is not configured, and
anyone can connect with any username.

In order to support authentication, the Freeciv21 server needs access to a database backend in which to store
the credentials. To support different database backends, the database access code is written in Lua using
Expand Down Expand Up @@ -35,7 +35,7 @@ Freeciv21 server. A good default location is the user's :file:`$HOME` directory.

[fcdb]
backend="sqlite"
database="/my/path/to/freeciv21.sqlite"
database="/home/user/freeciv21.sqlite"
jwrober marked this conversation as resolved.
Show resolved Hide resolved


For more information on the format of this file, see below. There are more settings available, but this file
Expand All @@ -46,9 +46,11 @@ storing passwords with MD5 hashes.

.. code-block:: sh

$ sudo apt install luarocks
$ sudo luarocks --lua-version 5.3 install md5
$ sudo luarocks --lua-version 5.3 install luasql-sqlite3
$ sudo apt install luarocks lua5.3 liblua5.3-dev libsqlite3-dev
$ lua -v # output should be 5.3.x
jwrober marked this conversation as resolved.
Show resolved Hide resolved
$ eval $(luarocks path --bin --lua-version 5.3)
$ luarocks --local --lua-version 5.3 install md5
$ luarocks --local --lua-version 5.3 install luasql-sqlite3


Lastly, we need to download the :file:`database.lua` script file.
Expand All @@ -58,6 +60,7 @@ Lastly, we need to download the :file:`database.lua` script file.
$ mkdir -p $HOME/.config/freeciv21
$ cd $HOME/.config/freeciv21
$ wget https://raw.githubusercontent.com/longturn/freeciv21/master/lua/database.lua
$ cd ~


Now start the server with:
Expand All @@ -75,9 +78,12 @@ command:
/fcdb lua sqlite_createdb()


Now you can create some users by connecting with the client. Due to the :code:`--Newusers` flag, when you
connect with the client with a previously unknown username, the server will prompt for a password and save the
new account to the database.
You should now see a :file:`/home/user/freeciv21.sqlite` file as per the same path given in the
:file:`fc_auth.conf` file.
jwrober marked this conversation as resolved.
Show resolved Hide resolved

At this time you are ready to create some users by connecting with the client. Due to the :code:`--Newusers`
flag, when you connect with the client with a previously unknown username, the server will prompt for a
password and save the new account to the database.

You may want to prepopulate the users table this way and then restart the server without :code:`--Newusers`
for the actual game, or you can run the game with :code:`--Newusers`.
Expand Down
Loading