Comments (7)
@viktorvan Can you check out the expression-concat branch and try this:
let database = sql { } // create db here...
// either using raw sprintf
let passwordRef = sprintf "concat('connection string stuff ...', %s, '...')" database.AdministratorCredentials.Password.AsArmRef.Value
// or using a custom function that knows how to splice values together correctly.
let passwordRef = concat [ literal "connection string stuff ..."; database.AdministratorCredentials.Password.AsArmRef; literal "..." ]
let fns = functions {
name "isaacsfunctions"
setting "sqlpass" passwordRef // just use here...
depends_on database.ServerName
}
from farmer.
I’ll try that when I am at my computer, but in the mean time I had another crazy idea 😁
Both the alternatives above force the user to know that you have to “concat” arm parameter values. What if, instead, the setting
-function hides this away by checking if the value contains any ArmRefs, i.e. if it contains any substrings “[parameters(‘key’)]”. They can then be replaced with the “concat” syntax required by the arm-template schema?
Edit: Or maybe not the setting
-function but probably the something in the Writer
module.
from farmer.
Ok, I had a chance to try the concat
function and it worked fine, but I ended up with this:
let connectionString =
concat
[ sprintf
"Server=tcp:%s.database.windows.net,1433;Initial Catalog=%s;Persist Security Info=False;User ID=%s;Password="
mySqlDb.ServerName.Value
mySqlDb.DbName.Value
mySqlDb.AdministratorCredentials.UserName
|> literal
mySqlDb.AdministratorCredentials.Password.AsArmRef
literal ";MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" ]
Which I don't think looks very nice though. Like I commented above, it would be nice to have some way to hide the concat
away.
I'll sleep on it, and think some more.
from farmer.
We can build a helper method on sql db to create a connection string?
from farmer.
Yes, that’s a great solution, much simpler 👍
from farmer.
Try now :-)
from farmer.
Yes that works for me. Nicely done. :)
from farmer.
Related Issues (20)
- Refresh token has expired HOT 2
- Support for autoscaling configurations
- Need more property settings in Virtual Network HOT 4
- Add support for creating application security groups and adding them to the NSG.
- Support for adding an ASG rule to a VM interface. HOT 1
- Add option to set DAPR protocol for Container Apps HOT 1
- Event Hub as dependency is invalid HOT 4
- Get existing project running
- Seems as if remote vnet peering for virtual networks does not support the remote vnet being in a different resource group HOT 1
- Deploying a function app overwrites the WEBSITE_CONTENTSHARE value HOT 1
- SQL Server Builder - Create System Assigned Identity HOT 3
- CosmosDB Gremlin support HOT 3
- P0V3 app service type is missing
- Add SupportsHttpsTrafficOnly property support for storage accounts
- Tests failing in CICD HOT 2
- Service Bus builder needs validation improvements
- Alert dependable on Action Group HOT 2
- App Service does not support Linux App Insights automatic instrumentation
- Upgrade to Fantomas 6
- No builder support for adding subnet per IP of LoadBalancer backendAddressPool
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from farmer.