CodeQuestor
CodeQuestor

Reputation: 911

How beego(Go App Framework) will reload the application if there is any change in the conf file?

I have developed the application using Golang Beego framework(http://beego.me/) and it is running in the production.

Suppose I edit the configuration file which is conf/app.conf, how can my app will be reloaded with restarting/rebuilding the application?

I tried to run the application using 'bee run' command but still no success in automatic reload.

Upvotes: 0

Views: 1513

Answers (2)

Bryce
Bryce

Reputation: 3354

You run the application with command bee run and it supports config file like this. bee command watch file change default by file extension. You can see from the source code var watchExts = []string{".go"}. It means bee will watch the file with extension .go, so if .go file change it will auto restarting.

If you want bee command to watch the conf/app.conf file, you need to make a file bee.json at your app directory and the content should like this:

{
    "version": 0,
    "gopm": {
        "enable": false,
        "install": false
    },
    "go_install": false,
    "watch_ext": [.conf],
    "dir_structure": {
        "watch_all": false,
        "controllers": "",
        "models": "",
        "others": []
    },
    "cmd_args": [],
    "envs": [],
    "database": {
        "driver": "mysql"
    }
}

Upvotes: 1

jupp0r
jupp0r

Reputation: 4670

You can use gin, it's really easy to set up:

gin is a simple command line utility for live-reloading Go web applications. Just run gin in your app directory and your web app will be served with gin as a proxy. gin will automatically recompile your code when it detects a change. Your app will be restarted the next time it receives an HTTP request.

Upvotes: 0

Related Questions