How to control where 'data' directory is created?

When I run the binary for gitea, it creates the ‘data’ directory in whichever directory I was in when I ran the binary.

I cannot find any combination of variables (such as GITEA_CUSTOM and GITEA_WORK_DIR) which change this behavior.

NOT including going into the directory I want the data directory to be placed in prior to running the binary, how can I control where this is created?

Hello. All configs are contained in app.ini. And the [server] section has parameter:
APP_DATA_PATH = data

You can read more about config file here

I think you misunderstood. There is no ini file yet.
I’m talking about a first run / install.

I know how to change where it looks AFTER it’s installed.

Surely the correct procedure isn’t

  1. Start binary
  2. Run install
  3. Stop binary
  4. Move data directory
  5. Edit ini
  6. Start binary

I find it hard to believe there’s not a way to define this location ahead of time.

You can copy app.ini.sample and set all parameters before first run

Sure, that will work, but that’s a hell of a workaround.

That suggests the whole install process is broken if it needs me to bypass the whole thing so a directory isn’t misplaced.

I wouldn’t call that workaround. What you are trying to do can easily be setup in the first-run setup on the site, set later after the config is generated from the first setup, or the easy, preferred method how AxiFive said.

You just simply create the config directories where your Gitea executable is and put in the params you want to set inside of an app.ini before the first run.

How is

  1. Creating the file(s) in the wrong place
  2. Killing the server
  3. Modifying the config
  4. Manually moving the files
  5. Restarting the server

or

  1. Bypassing the entire install process
  2. Manually creating the config file which the above process would have done for you

Not considered a workaround vs

  1. The data directory gets created where you define

If running Docker you can specify the data directory in the container using the volumes setting.

This isn’t in regards to the docker version. This is about the binary.