Adding a template file by relative path in Prometheus Alertmanager - relative-path

Suppose my alert manager setting file uses a template file located in the same directory as the setting file :
say,
/users/someAddress/settings.yml &
/users/someAddress/myTemplate.tmpl
Currently i use :
templates:
- '/users/someAddress/myTemplate.tmpl'
to refer to it. Can i use a relative path like /myTemplate.tmpl ?

Yes, you can.
Except /myTemplate.tmpl is not a relative path. myTemplate.tmpl is.

Related

How to Create .cmake File

I was working on a project which requires me to add a user.cmake file in the root directory. Can anyone help me out hot to create the .cmake file...
Link to Project Directory
According to the link you provided user.cmake just needs to point where so-called eego sdk is located in your file system:
set(EEGO_SDK_ZIP /path/to/download/eego-sdk-1.3.19.40453.zip)
There is nothing fancy actually here, just make a plain text file, put this one line (don't forget to replace the EEGO_SDK_ZIP variable content) and save it with the name user.cmake

Relative path inside a module

I have this module which needs a specific file to work. You can pass the path of the file you want to use or not. If you don't, then a default file is taken. That default file is located at the resources folder, so I typed the path as: "resources/data/type-graph.txt". The problem is that does not work because it takes my CWD as root directory.
Do you know how to make the path relative to the module dir?
Any suggestion is appreciated :).
You should take a look at the Modules documentation page.
There this example is given to access a file placed in the resources folder:
my $template-text = %?RESOURCES<templates/default-template.mustache>.slurp;
You also need to list the file in META6.json so the file will be accessible once the module is installed.
{
...,
"resources": [ "templates/default-template.mustache"]
}
As guifa noted in a comment %?RESOURCES works with individual files, not directory structures. It makes no guarantees of how the files are actually stored. So %?RESOURCES<templates>.dir will not work.

How to use an environment variable in the odoo.conf

I am trying to use an environment variable in the odoo.conf
file to specify the path where the logs are stored.
So far I have tried:
logfile = ${test.rueda}/odoo.log
But it does not work.
Is there any way to achieve this?
The Odoo configuration files do not support access to environment variables.
I can think of 2 possible approaches:
Use relative paths. The file names in the configuration are relative to the working directory of the Odoo server process. Start the Odoo server in different directories, one for every purpose, and keep the same structure relative to that.
Use environment variables in the command line. When starting the Odoo server, any configuration option can be passed using -- (2 dash signs) as a prefix. In the start script, you can then use environment variables as in any other shell script.
See https://www.odoo.com/documentation/11.0/reference/cmdline.html for details.
For referencing files or path:
When i work without external disk (where i can find my datadir):
i use in odoo config file data_dir = my_absolute_path_in_my_local_disk.
This path have a symbolic redirection to where is my local physical location of my local data directory
When my external disk come back, i change the symbolic link:
my_absolute_path_in_my_local_disk -> my_external_disk_..._data

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

Marklogic - Adding a default rule set through admin console

I have defined a default ruleset through admin console. I have given the location of the ruleset as "C:/isParentOf.rules". However, it is not able to find this file. While running a query, it is complaining that
" The ruleset file cannot be found: C:/isParentOf.rules"
I have tried giving a relative path but it does not seem to work.
Can someone suggest what is the right way to specify the location of the ruleset and where ideally should it be kept (along with existing .rules files)
Thanks
Custom rulesets can be placed inside the MarkLogic installation dir under Config/, but I'd recommend uploading it to the schemas database. See also:
http://docs.marklogic.com/guide/semantics/inferencing#id_pgfId-924845
HTH!