GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ‘‘ GOLF(2gg) β€” bestie edition

okay so this is GOLF, section 2gg, from the Development corner of the manual-verse. Strap in, we're setting up an app and it's gonna be ✨immaculate✨.


🌸 NAME 🌸

application-setup β€” the Golf documentation, specifically the running-application part. this is the "how do i actually get my lil app off the ground" page. iykyk.


πŸŽ€ DESCRIPTION πŸŽ€

✨ INITIALIZE APPLICATION ✨

first things first: your Golf application has to be initialized. no init, no app, periodt. and what does "initialized" even mean? it means you create a whole directory structure, and that structure is owned by the application owner β€” and the application owner can literally be any Operating System user. whoever you want, bestie. it's giving flexible.

so, to initialize an application called <app name>, while you're logged in as the application owner, you run:

sudo mgrg -i -u $(whoami) <app name>

that's it. that's the whole vibe. πŸ’…


πŸ—„οΈ SETUP DATABASE(S) πŸ—„οΈ

heads up: if your application does not use database(s), you can straight up skip this entire section. no database, no drama, moving on. πŸ¦‹

okay so for the rest of you with databases β€” you can set them up any way you see fit. genuinely any way. that includes creating the database objects your app uses, like tables or indexes, whatever you need.

the one thing Golf actually needs to know is the connection parameters. those include database login info, but they can include other stuff too β€” Golf isn't picky, it just wants the deets.

for each database in use, you gotta provide a database-config-file sitting in the same directory as your Golf source code. that file holds the connection parameters, and those parameters are database-specific β€” every database does its own thing, respect the differences bestie.

so, for example, if your code has statements like:

run-query @mydb = ...

//or

begin-transaction @sales_db

then you must have files mydb and sales_db present. no file, no connection, no slay. 😭

for example, a MariaDB config file might look like:

[client]
user=golfuser
password=pwd
database=golfdb
protocol=TCP
host=127.0.0.1
port=3306

or for PostgreSQL:

user=myuser password=mypwd dbname=mydb

see? cute, small, does the job. πŸ“


πŸ”¨ MAKE APPLICATION πŸ”¨

time to compile and link, babes. for an application that doesn't use database(s):

gg -q

and when you do have database(s) in use? say, using the example from above β€” where mydb is a MariaDB database, sales_db is PostgreSQL, and contacts is SQLite β€” you'd do:

gg -q --db="mariadb:mydb postgres:sales_db sqlite:contacts"

look at that flag doing the absolute most. πŸ”₯

See gg for more options β€” there's a lot more where that came from.

πŸš€ START APPLICATION πŸš€

rule number one: stop the application first, just in case it was already running. don't be the person who starts a thing twice, it's not the vibe.

then start it. for example:

mgrg -m quit <app name>
mgrg -w 3 <app name>

quit, then go. clean. ✨

See mgrg for more details.

πŸƒ RUNNING APPLICATION πŸƒ

you can run your application as a service, as CGI, or as command-line. three flavors, all valid, pick your fighter. πŸ’–


🌈 SEE ALSO 🌈

  • Running application
  • application-setup
  • CGI
  • command-line
  • service
  • See all documentation

okay that's the whole page bestie, you're officially set up and iconic for it. 🫢

this lil masterpiece was served to you by $VERSION, dated $DATE β€” and yes, it's still GOLF(2gg) at the bottom, as tradition demands. mwah. πŸ’‹

πŸ“¦ where this page comes from