Base solution for your next web application
Open Closed

How to store ConnectionString value in order to set it later in Dockerfile? #9168


User avatar
0
dzungle created

Hello Support Team,

I am using .NET Core and Angular project template. I want to set ConnectionString value in Dockerfile. Could you please tell me how to do this? Thank you very much.

Best Regards,

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    dzungle created

    Hello @ismcagdas,

    Thank you for your quik support. I'm newbie to dockerization. Please, help me sort out some more questions.

    Do I need to declare "ConnectionStrings__Default" & "Abp__RedisCache__ConnectionString" (or any other environment variables) in ASP.NET Core code? If yes, where to declare them? And how to get the values of these environment variables?

    Thank you in advance

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    musa.demir created

    These settings are located in the appsettings.json. It uses these settings when you debug or don't use docker

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    dzungle created

    You mean to say that in runtime the app container will automatically convert the variable "ConnectionStrings__Default" into "ConnectionStrings:Default" in C# code?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @dzungle,

    Yes.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    dzungle created

    Thank you for your support, @ismcagdas

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)