2019-10-14 13:10:33 +02:00
|
|
|
import { QWeb } from "./qweb/index";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This file creates and exports the OWL 'config' object, with keys:
|
|
|
|
|
* - 'mode': 'prod' or 'dev',
|
2019-10-14 15:09:17 +02:00
|
|
|
* - 'env': the environment to use in root components.
|
2019-10-14 13:10:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
interface Config {
|
|
|
|
|
mode: string;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-14 15:09:17 +02:00
|
|
|
export const config = {} as Config;
|
2019-10-14 13:10:33 +02:00
|
|
|
|
2019-10-14 15:09:17 +02:00
|
|
|
Object.defineProperty(config, "mode", {
|
2019-10-14 13:10:33 +02:00
|
|
|
get() {
|
|
|
|
|
return QWeb.dev ? "dev" : "prod";
|
|
|
|
|
},
|
|
|
|
|
set(mode: string) {
|
|
|
|
|
QWeb.dev = mode === "dev";
|
|
|
|
|
if (QWeb.dev) {
|
|
|
|
|
const url = `https://github.com/odoo/owl/blob/master/doc/tooling.md#development-mode`;
|
|
|
|
|
console.warn(
|
|
|
|
|
`Owl is running in 'dev' mode. This is not suitable for production use. See ${url} for more information.`
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
console.log(`Owl is now running in 'prod' mode.`);
|
|
|
|
|
}
|
2019-10-31 21:28:35 +01:00
|
|
|
}
|
2019-10-14 13:10:33 +02:00
|
|
|
});
|