Configuration file in Azure Functions - azure

I need to read from a JSON configuration file in Azure Function. Is there a way to refer to the file without hard-coding any paths(assuming it's in same directory as the code).
The solution in another answer was something like:
string configuration = string.IsNullOrEmpty(configurationFile) ? "" : File.ReadAllText(Environment.GetEnvironmentVariable("HOME") + #"\site\wwwroot\functionname\filename);
Is there a better way to get this path, or read JSON configuration in general for Azure Function?

Currently, the solution you found is the recommended approach, but with the next release, which is starting to roll out today (5/30/2017), we've introduced a feature to enhance this.
You can learn more about it here:
https://github.com/Azure/azure-webjobs-sdk-script/wiki/Retrieving-information-about-the-currently-running-function

you're able to find out some explanations about this same topic on this another thread, here.
I hope that this information help you.

Related

Using variables with YAML in Node.js

Is there any way to parse data to a .yaml file in node.js? I've been searching about this for hours and found nothing useful.
Let's say I have a string in a .yaml file:
message: Hello, ${user.fullName}, have a nice day.
As I've been reading, there's something called "placeholders" but it seems only available in spring framework.
This is what I found.
And in other places, they use a different syntax like {{user.fullName}}
So, is there any way to replace ${user.fullName} with an actual value in node.js? I don't know if I should manually handle this thing that they call "placeholder" myself with string.replace(). I checked the main YAML docs and there's nothing called "placeholder" or even "variable" in their entire docs!
But, similarly, I can achieve a similar result with pug.js using #{user.fullName} (with # instead) and then call something like: pug.renderFile('template.pug', {fullName: 'Timothy'}). Check pug.js docs for more details.
Thanks for your help!

Can we use regular expression to mention cucumber options feature files?

#CucumberOptions(features = {"src/test/resources/features/module*.feature"},
tags = "#E2e",)
mvn clean verify -Dcucumber.features=”module*.feature” -Dcucumber.filter.tags="#E2E"
Is there any way to use regex to identify feature files? It takes it up as file name.
I want moduleone,moduletwo,modulethree to get executed.
PS: I am aware about tags but my logic is in such a way that using feature regex will help me.
The short answer is no. You can not. You can only reference files or directories. Patterns are not supported.

Airflow operator to download email to s3

I'm working on writing a DAG that will download a file from email directly to s3. I figured there would already be operators I can use to help with this. I found the following link but I'm not sure what the parameters 'imap_conn_id' and 's3_conn_id' should be.. any help with this would be appreciated. If you know a better operator with examples, that be great to!

How to set current date time in Configuration Block

i follow the instruction(below link) to set trigger to the current date time in Configuration Block
but the trigger={date}{time}; does not work, it return error
" the configuration block was not well-formed."
who know the right expression for the current date? thanks a lot
https://support.tibco.com/s/article/How-to-append-rows-and-update-data-table-on-a-frequent-basis
this looks like either a typo on the article, or a bug in the Automation Services Job Builder. you can get around this message by surrounding the values with quotes, so
trigger="{date}{time}";
while the quotes are not required (according to Configuration Block documentation), I would argue that it's a best practice because you never know if the value you're passing is going to jank up the configuration block parser.
also a tip: you can and probably should test any configuration blocks in the Web Player before deploying a job in Automation Services. when doing this, don't forget to URLEncode, like, everything. here's an example from the documentation I linked above:
http://spotfire.cloud.tibco.com/spotfire/wp/OpenAnalysis?file=/Gallery/Introduction%20to%20Spotfire&configurationBlock=SetFilter(
tableName=%22World%20Bank%20Data%22,columnName=%22Region%22,values=%7B%22North%20America%22,%22Europe%20%26%20Central%20Asia%22%7D);
and a link of that example in action.

Sphinx4 figuring out correct models

I am trying to use the Sphinx4 library for speech recognition, but I cannot seem to figure out the correct combination of acoustic model-dictionary-language model. I have tried out various combinations and I get a different error every time.
I am trying to follow the tutorial on http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4. I do not have a config.xml as I would if I was using ConfigurationManager instead of Configuration, because there is no perceivable way of passing the location of the config file to the Configuration itself (ConfigMgr takes it as an argument to the constructor); and that might be my problem right there. I just do not know how to point to one, and since the tutorial says "It is possible to configure low-level components of the application through XML file although you should do that ONLY IF you understand what is going on.", I assume having a config.xml file is not compulsory.
Combining the latest dictionary (7b - obtained from Sourceforge) with the latest acoustic model (cmusphinx-en-us-5.2.tar.gz - from SF again) and the language model (cmusphinx-5.0-en-us.lm.gz - from SF again) results in NullPointerException in startRecognition. The issue is similar to the problem here: sphinx-4 NullPointerException at startRecognition, but the link given in the answer no longer works. I obtained 0.7a from SF (since that is the dict the link seems to point at), but I am getting even earlier in the execution Error loading word: ;;; when I use that one. I tried downloading latest models and dict from the Github repo, that results in java.lang.IndexOutOfBoundsException: Index: 16128, Size: 16128.
Any help is much appreciated!
You need to use latest code from github
http://github.com/cmusphinx/sphinx4
as described by tutorial
http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4
Correct models (en-us) are already included, you should not replace anything. You should not configure any XML files, use samples as provided in the sources.

Resources