nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.25k stars 322 forks source link

Ability to read mounted configuration file #1192

Closed stefkkkk closed 3 months ago

stefkkkk commented 3 months ago

Hi! Have you any plans about to give an opportunity to read mounted config files? Not only update/upload it via API.

javorszky commented 3 months ago

Hi @stefkkkk,

Thanks for getting in touch. Unit already has this capability, see the documentation on https://unit.nginx.org/controlapi/#api-manipulation, and the example with the text To get the complete /config section:

Send a GET request at the control api /config route.

Hope this helps :)

stefkkkk commented 3 months ago

Hi @stefkkkk,

Thanks for getting in touch. Unit already has this capability, see the documentation on https://unit.nginx.org/controlapi/#api-manipulation, and the example with the text To get the complete /config section:

Send a GET request at the control api /config route.

Hope this helps :)

I mean the same behaviour as in classic nginx, I exactly don't want to use API, instead I want to mount config and unitd deamon will read this config from the file

ac000 commented 3 months ago

I don't think that was the question.

I think they more wanted to know if Unit could read an existing config file from the filesystem.

Yes, it can and does, you can place a config file into $(STATEDIR)/conf.json

See unitd --version for where the --statedir points to.

The caveat is I don't think we make any guarantees about the stability of the mechanism. But it's worked up to now, and I don't see any real reason to break it...

stefkkkk commented 3 months ago

I don't think that was the question.

I think they more wanted to know if Unit could read an existing config file from the filesystem.

Yes, it can and does, you can place a config file into $(STATEDIR)/conf.json

See unitd --version for where the --statedir points to.

The caveat is I don't think we make any guarantees about the stability of the mechanism. But it's worked up to now, and I don't see any real reason to break it...

Yeap, it works, thanks a lot for such quick reply! May be make sense to add this into documentation?

ac000 commented 3 months ago

Yeap, it works, thanks a lot for such quick reply! May be make sense

You're welcome.

to add this into documentation?

I think the reason it's not documented is the caveat I mentioned...

Maybe this is something we'll revisit one day...