In a docker_secrets file, do values need to be wrapped in quotes? - docker-secrets

Which of these is correct?
NPM_TOKEN=16565cd2-f5b3-36b6-997d-07e5fghf9988b1
NPM_TOKEN="16565cd2-f5b3-36b6-997d-07e5fghf9988b1"
Where are quotes needed. What about numeric data?

Related

Is it possible to pass a multi-word argument on command-line when all arguments are already covered in double quotes?

Here is what I am trying to do, pass TCL script and parameters to Libero.exe. The method is given in document DS50003100B page 20 as follows:
C:\libero\designer\bin\libero SCRIPT:testTclparam.tcl “SCRIPT_ARGS:a b c”
LOGFILE:testTclparam.log
I am not sure why the SCRIPT_ARGS is surrounded by double quotes. Anyway, I need to pass in these parameters:
RTG4
RT4G150
352 CQFP
Actel:SgCore:RTG4URAM:1.1.106
The problem is with the third parameter. It is interpreted as two separate paramters, rather than a single value containing space character. The PACKAGE parameter has the form where it has a number and alphabetic value separated by space.
Is there anyway to pass multi-word parameter (a single value containing space) when all parameters are already covered in double quotes?
This does not work:
C:\libero\designer\bin\libero SCRIPT:testTclparam.tcl “SCRIPT_ARGS:RTG4 RT4G150 "352 CQFP" Actel:SgCore:RTG4URAM:1.1.106”
LOGFILE:testTclparam.log
That is why I am on this forum.

Keep text delimiters after !!str "some text" or !!str 'some text'

I have some data to be used to generate SQL, therefore it is important which text delimiters are used (single quotes ' delimits string literal but double quotes " delimit identifiers, at least in Oracle db).
For load procedure generator I used this
someKey: !!str 'Some SQL text'
and expected that someKey would contain the whole string including single quotes: 'Some SQL text'.
However, js-yaml.safeLoad() interprets the data as Some SQL text which is not what I wanted.
The workaround is easy, I can put the literal into additional quotes:
someKey: "'Some SQL text'"
which gives the expected result. However, I am not quite sure why in that case do we need !!str tag in YAML if it does virtually nothing (it is useful only for explicit interpretation number literals, true, false and null) and it is actually almost the same as putting double quotes around the text.
I would prefer to post this into some YAML-spec-related forum but it seems there is none.
Apart from the standard workaround, is there any trick that would do what I originally wanted, i.e. interpret any content after object key as string (+trimming off any initial and trailing spaces) without dealing with double quotes?
In YAML tag !!str is a predifened denoting a string scalar. If you specify that then even things that without that tag (or without quotes) would not be considered a string scalar, like 123, True or null.
Some string scalars need quotes e.g. if they start with a quote or double quote, if special characters need backslash espacing, or if there is a : (colon, space) in the string (which could confuse the parser to intrepret the string scalar as a key-value pair.
However putting !!str before something doesn't make it quoted (which should be obvious as it doesn't define what kind of quoting and single quoted scalars have vastly different rules from double quoted scalars).
Your workaround is not a workaround, that is just one of the ways in YAML you can specify a string scalar that starts and ends with a single quote. Another way is:
someKey: |-
'Some SQL text'
Within literal block style scalars quotes (single or double) are interpreted as is even at the beginning of the scalar. The - makes sure you don't get an extra newline after the final '

Escape characters in teradata jdbc connection string

I have a teradata database name that contains a dash character -.
Searched the web but in vain. Does somebody know how can you escape the special characters in jdbc connection string? The string looks as follows:
jdbc:teradata://HostName/DATABASE=Database-Name
When I create a connection with this url I get syntax error. Also tried to put database parameter in single or double quotes, and to surround the special charachers with { }.
Thanks for help!
Finally found the answer here: https://jira.talendforge.org/browse/TDI-18863. The correct way is to enclose both parameter name and value in single quotes:
jdbc:teradata://HostName/'DATABASE=Database-Name'
Update: No, this does not work, see comment below.
Answering my own question:
My problem was that I didn't realise that my database name had some trailing whitespaces in the end.
TeraDriver uses single quotes to escape spaces and commas. This means that the database name should be in single quotes. If there are no single quotes, spaces and commas are considered to be the end of parameter value. If there are single quotes in database name, they should be presented as two single quote characters.
'Database-Name '
Whatever is within single quotes will be used with sql query: "database Database-Name". To escape '-' we need double quotes. So both single and double quotes in correct order should be used:
"jdbc:teradata://HostName/DATABASE='\"Database-Name\"'"
Have you tried a \ character which is supposed to be an escape character in Java?
jdbc:teradata://HostName/DATABASE=Database\-Name

Interpolation within single quotes

How can I perform interpolation within single quotes?
I tried something like this but there are two problems.
string = 'text contains "#{search.query}"'
It doesn't work
I need the final string to have the dynamic content wrapped in double quotes like so:
'text contains "candy"'
Probably seems strange but the gem that I'm working with requires this.
You can use %{text contains "#{search.query}"} if you don't want to escape the double quotes "text contains \"#{search.query}\"".
'Hi, %{professor}, You have been invited for %{booking_type}. You may accept, reject or keep discussing more about this offer' % {professor: 'Mr. Ashaan', booking_type: 'Dinner'}
Use
%q(text contains "#{search.query}")
which means start the string with single quote. Or if you want to start with double quote use:
%Q(text contains '#{text}')

Expand single quotes in a Net::HTTP variable?

I am using Net::HTTP to get a request from a Google API with a custom header:
req = Net::HTTP::Get.new(uri.request_uri, {'Authorization' => 'GoogleLogin auth=#{auth}'})
The #{auth} is a variable that changes each time I run the program, so I made a variable with it, but the single quotes don't expand it. I can't change the single quotes to double quotes, because Google only accepts the header with single quotes.
Is there any way to expand the variable but keep the single quotes?
However, I can't change the single quotes to double quotes, because google only accepts the header with single quotes.
So hard to believe it.
Anyway, try Kernel%sprintf or its shorter version just str % [arguments..]. It will help.

Resources