Merging Hugo Server's CMD Arguments into config.toml

Is it possible to transfer the following hugo CMD arguments into the config.toml file (of various scope as in _default, development, and production) so that the end user can just safely use hugo server and hugo without needing to supply additional arguments for respective rendering and building their site?

# BASH
hugo server --noBuildLock \
                --disableFastRender \
                --port 8080 \
                --gc

# BAT
hugo server --noBuildLock ^
        --disableFastRender ^
        --port 8080 ^
        --gc

Context:

  1. I’m currently maintaining a BASH+BAT script to wrap the hugo command lines and their arguments. I do not intend to further maintaining this hybridized script and wish to instruct user to just use hugo server and hugo without compromising the theme module user experience.
  2. I’ve been digging through the source codes but I’m not sure what config can be sourced from the config file. (Ref: hugo/config.go at f1062519ae7d5dd41b681e43e992dbc66fcd0855 · gohugoio/hugo · GitHub)

Reference:

  1. Current latest config setup: Hestia/hestiaHUGO/config at experimental · ZORALab/Hestia · GitHub
  2. Current hybridized server initialisation script (link can break if the script is successfully replaced): Hestia/server.cmd at experimental · ZORALab/Hestia · GitHub

Short answer: No. (Disclaimer: not to my knowledge)

Longer answer: Your approach is right. Create scripts for these functions (hugo and hugo server).

What you could do to enhance and ease the use of these scripts is to look into a way to read a local .env file that contains for instance port and IP information to run the server. That’s how I do it. On linux though, not sure if there is an equivalent on WIndows.

After that $IP and $PORT in my bash script have the values in .env.

1 Like

Oh dear. Guess I’ll live with it. Thanks. the hugo instruction doesn’t require a script because it’s wholesome already.

It is the server that is the headache.

Nah, it’s okay. Hugo reported the address for the users. =)

Thanks for the tip.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.