# IResourceWithEnvironment

- Module: [Aspire.Hosting](/reference/api/typescript/aspire.hosting.md)
- Version: `13.3.0`
- Kind: `interface`
- Source: [GitHub](https://github.com/microsoft/aspire)

## Definition

```typescript
interface IResourceWithEnvironment {
  withCertificateTrustScope(scope: CertificateTrustScope): IResourceWithEnvironment;
  withDeveloperCertificateTrust(trust: boolean): IResourceWithEnvironment;
  withEnvironment(
      name: string,
      value: IExpressionValue): IResourceWithEnvironment;
  withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise<void>): IResourceWithEnvironment;
  withHttpsDeveloperCertificate(password?: ParameterResource): IResourceWithEnvironment;
  withOtlpExporter(protocol?: OtlpProtocol): IResourceWithEnvironment;
  withoutHttpsCertificate(): IResourceWithEnvironment;
  withReference(
      source: EndpointReference|string|uri,
      connectionName?: string,
      optional?: boolean,
      name?: string): IResourceWithEnvironment;
  withReferenceEnvironment(options: ReferenceEnvironmentInjectionOptions): IResourceWithEnvironment;
}
```

## Methods

- [withCertificateTrustScope](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withcertificatetrustscope.md) -- `method` -- Sets the certificate trust scope
    ```typescript
  withCertificateTrustScope(scope: CertificateTrustScope): IResourceWithEnvironment
  ```
- [withDeveloperCertificateTrust](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withdevelopercertificatetrust.md) -- `method` -- Configures developer certificate trust
    ```typescript
  withDeveloperCertificateTrust(trust: boolean): IResourceWithEnvironment
  ```
- [withEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withenvironment.md) -- `method` -- Sets an environment variable
    ```typescript
  withEnvironment(name: string, value: IExpressionValue): IResourceWithEnvironment
  ```
- [withEnvironmentCallback](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withenvironmentcallback.md) -- `method` -- Sets environment variables via callback
    ```typescript
  withEnvironmentCallback(callback: (arg: EnvironmentCallbackContext) => Promise<void>): IResourceWithEnvironment
  ```
- [withHttpsDeveloperCertificate](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withhttpsdevelopercertificate.md) -- `method` -- Configures HTTPS with a developer certificate
    ```typescript
  withHttpsDeveloperCertificate(password?: ParameterResource): IResourceWithEnvironment
  ```
- [withOtlpExporter](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withotlpexporter.md) -- `method` -- Configures OTLP telemetry export
    ```typescript
  withOtlpExporter(protocol?: OtlpProtocol): IResourceWithEnvironment
  ```
- [withoutHttpsCertificate](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withouthttpscertificate.md) -- `method` -- Removes HTTPS certificate configuration
    ```typescript
  withoutHttpsCertificate(): IResourceWithEnvironment
  ```
- [withReference](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withreference.md) -- `method` -- Adds a reference to another resource
    ```typescript
  withReference(source: EndpointReference|string|uri, connectionName?: string, optional?: boolean, name?: string): IResourceWithEnvironment
  ```
- [withReferenceEnvironment](/reference/api/typescript/aspire.hosting/iresourcewithenvironment/withreferenceenvironment.md) -- `method` -- Configures which reference values are injected into environment variables
    ```typescript
  withReferenceEnvironment(options: ReferenceEnvironmentInjectionOptions): IResourceWithEnvironment
  ```
