fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

Connection strings type provider #38

Closed aaronpowell closed 9 years ago

aaronpowell commented 9 years ago

Copied the AppSettings type provider to be used for connection strings as well.

aaronpowell commented 9 years ago

Hmm, don't get what's causing the build to fail.

vasily-kirichenko commented 9 years ago

In general this TP seems an overkill to me. What do you think about an idea to add connection strings as a property to AppConfig TP? I mean something like:

type Settings = AppSettings<"app.config">
let connString1 = Settings.ConnectionStrings.Test1

My motivation is that all data from app.config should be represented by single TP. And the less TPs we have the better (less code, easier to maintain).

@forki what do you think?

aaronpowell commented 9 years ago

I thing that'd make good sense, I just made it separate ad the existing AppSettings looked like it was for the node.

If you'd prefer I'll collection stings up.

Sent from my Windows Phone


From: Vasily Kirichenkomailto:notifications@github.com Sent: ‎19/‎10/‎2014 22:30 To: fsprojects/FSharp.Configurationmailto:FSharp.Configuration@noreply.github.com Cc: Aaron Powellmailto:me@aaron-powell.com Subject: Re: [FSharp.Configuration] Connection strings type provider (#38)

In general this TP seems an overkill to me. What do you think about an idea to add connection strings as a property to AppConfig TP? I mean something like:

type Settings = AppSettings<"app.config">
let connString1 = Settings.ConnectionStrings.Test1

My motivation is that all data from app.config should be represented by single TP. And the less TPs we have the better (less code, easier to maintain).

@forki what do you think?


Reply to this email directly or view it on GitHub: https://github.com/fsprojects/FSharp.Configuration/pull/38#issuecomment-59646903

aaronpowell commented 9 years ago

Woo! Working with a nested property. I was originally using the erasedType helper but it wasn't working but using the same approach as the IniFileProvider to create the nested ProvidedTypeDefinition without specifying the assembly/namespace works a treat.

Also updated the docs to reflect the changes.

So does this look more along the lines of what you're looking for?

vasily-kirichenko commented 9 years ago

Great job!

@forki I've no idea why travis build failed :(

aaronpowell commented 9 years ago

Yay :smile:

Any idea when this will appear on NuGet?

forki commented 9 years ago

@vasily-kirichenko do you have all the rights to release?

vasily-kirichenko commented 9 years ago

I dunno. What is the procedure?

forki commented 9 years ago

I do it as describe in http://fsprojects.github.io/ProjectScaffold/release-process.html

If you want to try I could add your nuget user name to the package. (what's your nuget.org username?) Otherwise I can do it.

2014-10-22 6:46 GMT+02:00 Vasily Kirichenko notifications@github.com:

I dunno. What is the procedure?

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/FSharp.Configuration/pull/38#issuecomment-60036139 .

vasily-kirichenko commented 9 years ago

My NuGet user name is vaskir. Please add it and I'll try to push the package.

forki commented 9 years ago

Done On Oct 22, 2014 9:50 AM, "Vasily Kirichenko" notifications@github.com wrote:

My NuGet user name is vaskir. Please add it and I'll try to push the package.

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/FSharp.Configuration/pull/38#issuecomment-60048232 .

vasily-kirichenko commented 9 years ago
Failed to process request. 'The specified API key is invalid or does not have permission to access the specified package
.'.
The remote server returned an error: (403) Forbidden..
Running build failed.
Error:
System.Exception: Error during NuGet push. l:\github\FSharp.Configuration\packages\NuGet.CommandLine\tools\NuGet.exe pus
h "l:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.4.4.nupkg" PRIVATEKEY
   at Fake.NuGetHelper.NuGet(FSharpFunc`2 setParams, String nuspecFile) in D:\code\fake\src\app\FakeLib\NuGet\NugetHelpe
r.fs:line 348
   at FSI_0001.Build.clo@168-13.Invoke(Unit _arg7) in l:\github\FSharp.Configuration\build.fsx:line 178
   at Fake.TargetHelper.runTarget@314(String targetName) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 325
forki commented 9 years ago

image

vasily-kirichenko commented 9 years ago

yes, I did not conform it. Sorry.

Now I have another error:

1) System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurre
while sending the request. ---> System.Net.WebException: The remote server returned an error: (407) Proxy Authenticati
 Required.
 at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
 at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
 --- End of inner exception stack trace ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Internal.HttpClientAdapter.<Send>d__2`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Connection.<RunRequest>d__18`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Connection.<Run>d__14`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.ApiConnection.<Post>d__12`1.MoveNext()
 --- End of inner exception stack trace ---
 at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](Result`1 res)
 at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computati
, FSharpOption`1 timeout)
 at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharp
tion`1 cancellationToken)
 at Fake.TargetHelper.runTarget@314(String targetName) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 325
-> (Inner Exception #0) System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System
et.WebException: The remote server returned an error: (407) Proxy Authentication Required.
 at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
 at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
 --- End of inner exception stack trace ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Internal.HttpClientAdapter.<Send>d__2`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Connection.<RunRequest>d__18`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.Connection.<Run>d__14`1.MoveNext()
- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Octokit.ApiConnection.<Post>d__12`1.MoveNext()<---
vasily-kirichenko commented 9 years ago

As a result, the documentation has not been updated, however the package has been published.

forki commented 9 years ago

seems octokit is failing to connect to https://github.com/fsprojects/FSharp.Configuration/releases

remote server returned an error: (407) Proxy Authentication Required.

I think @shiftkey needs to handle proxies ;-)

That said: in order to push the docs please run:

build.cmd ReleaseDocs    
vasily-kirichenko commented 9 years ago

Should I run my secret build.cmd or the usual one?

If I run my secret, I get:

Failed to process request. 'A package with id 'FSharp.Configuration' and version '0.4.4' already exists and cannot be mo
dified.'.
The remote server returned an error: (409) Conflict..
Running build failed.
Error:
System.Exception: Error during NuGet push. l:\github\FSharp.Configuration\packages\NuGet.CommandLine\tools\NuGet.exe pus
h "l:\github\FSharp.Configuration\nuget\FSharp.Configuration.0.4.4.nupkg" PRIVATEKEY
   at Fake.NuGetHelper.NuGet(FSharpFunc`2 setParams, String nuspecFile) in D:\code\fake\src\app\FakeLib\NuGet\NugetHelpe
r.fs:line 348
   at FSI_0001.Build.clo@168-13.Invoke(Unit _arg7) in l:\github\FSharp.Configuration\build.fsx:line 178
   at Fake.TargetHelper.runTarget@314(String targetName) in D:\code\fake\src\app\FakeLib\TargetHelper.fs:line 325
forki commented 9 years ago

use the other one. The missing nuget key in the public build.cmd will skip the nuget push

vasily-kirichenko commented 9 years ago

it's run successfully but the docs has not updated.

forki commented 9 years ago

do you have a local gh-pages branch?

seems there was no push to gh-pages.

I just run it and seems to work on my machine.

vasily-kirichenko commented 9 years ago

No, there was no that local branch. Seems to work now. Thanks. I think it's a good idea to add this fact to the documentation.

forki commented 9 years ago

Yes will do. On Oct 22, 2014 11:27 AM, "Vasily Kirichenko" notifications@github.com wrote:

No, there was no that local branch. Seems to work now. Thanks. I think it's a good idea to add this fact to the documentation.

— Reply to this email directly or view it on GitHub https://github.com/fsprojects/FSharp.Configuration/pull/38#issuecomment-60058422 .

shiftkey commented 9 years ago

I think @shiftkey needs to handle proxies ;-)

It's not documented well, but there is support: https://github.com/octokit/octokit.net/blob/6a3c08e2b48d035e47ff08180119ee8fe67e3f06/Octokit/Http/HttpClientAdapter.cs#L41-L45

See https://github.com/octokit/octokit.net/pull/306 for the PR

forki commented 9 years ago

How about setting the default proxy like https://github.com/fsprojects/Paket/commit/4e01f268b3ac20da0b6930d3aecb926b531837c5#diff-472ca1ebd4aa3f7af83def7a0255676bR11

this idea is by @vasily-kirichenko and worked in paket.