Giter Site home page Giter Site logo

tatsuukraine / dart_environment_config Goto Github PK

View Code? Open in Web Editor NEW
91.0 91.0 8.0 82 KB

Environment specific config generator for Dart and Flutter applications during CI/CD builds

Home Page: https://pub.dev/packages/environment_config

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%
ci-cd configuration dart dotenv environment environment-configuration environment-variables flutter

dart_environment_config's People

Contributors

tatsuukraine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dart_environment_config's Issues

Add verbose command run

  • add verbose command run
  • add lock file generation to define diff between specified fields in local env and new fields for verbose command run

feature suggestion: export to .env change to import from .env

It is so confusing that this package support a feature as export to .env.

Where can we get the env variables locally or in cloud? It must be some common settings, like .env files or CI variables. It is unnecessary to export it, but I often need to import from a .env that is ignored by git and different in local env and cloud env.

With import feature, locally I can use .env file to export the env variables, and user CI env variables in CI pipelines.

Multiple dotenv_path s

It would be very nice to have the option to define multiple dotenv_path in the YAML. This is very useful for providing fields to many native layers. But currently it is only possible to provide a .env file for either the Android or the iOS Project, since dotenv_path cannot be defined multiple times.

yaml dependency with flutter 2.0.4

Flutter has now marked version 2.0.4 as stable https://flutter.dev/docs/development/tools/sdk/releases

in my pubspec.yaml the below two dependencies are included
environment_config: ^2.2.5
flutter_launcher_icons: ^0.9.0

When i execute flutter pub get I am getting the below error when using flutter 2.0.4

Because environment_config >=2.2.2 depends on yaml ^2.0.0 and flutter_launcher_icons >=0.9.0 depends on yaml ^3.0.0-nullsafety.0, environment_config >=2.2.2 is incompatible with flutter_launcher_icons >=0.9.0.
So, because myapp depends on both environment_config ^2.2.5 and flutter_launcher_icons ^0.9.0, version solving failed.

Are there any plans to update yaml dependency?

Add ability to build just `.env` file

Some variants:

  • add key exclude (default to false) to field key to exclude this field from Dart class, with dotenv: true this key will be added just to .env file
  • add key to config generate_class (default to true), that will exclude Dart class generation

Error on Flutter 2.2.0

Failed to precompile environment_config:generate:
/root/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:1600:40: Error: Getter not found: 'topLevelVariable'.
return kinds.contains(TargetKind.topLevelVariable);
^^^^^^^^^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Getter not found: 'topLevelVariable'.
case TargetKind.topLevelVariable:
^^^^^^^^^^^^^^^^
/root/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Type 'dynamic' of the case expression is not a subtype of type 'TargetKind' of this switch expression.

  • 'TargetKind' is from 'package:meta/meta_meta.dart' ('/root/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta_meta.dart').
    case TargetKind.topLevelVariable:
    ^
    /root/.pub-cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2001:13: Context: The switch expression is here.
    switch (this) {
    ^
    pub finished with exit code 1

Is it possible to define a bool in the config file?

Hey, awesome package!

Have a question:

Is it possible to define a bool in the config file?

environment_config:
  path: environment_config.dart

  fields:
    fake_api:
      type: bool
      const: TRUE
      default: false
      config_field: TRUE
      static: TRUE

Currently, it crashes during config parsing with an error

type 'bool' is not a subtype of type 'String'

Thanks!

version: 2.2.2

Dependencies conflict

Hello. Have a conflict with build_runner 1.10.6

So, because project depends on both environment_config ^2.2.4 and build_runner ^1.10.6, version solving failed.)

Null dev_extension throws error

Hey, I am not sure if this is intentional or not but leaving the default line

  dev_extension: # optional, by default undefined, allows to specify command option to use extension

in environment_config.yaml throws an exception when running dart run environment_config:generate:

type 'Null' is not a subtype of type 'String'

However clearing this line fixes this issue.

Environment variables produce invalid syntax

Perhaps I am doing something incorrect here.

environment_config:
  path: environment.dart
  class: Environment
  fields:
    api:
      type: String
      short_name: a
      pattern: 'https://__VALUE__'
      env_var: API_DOMAIN

Set your environment variable(s)

export API_DOMAIN="api.local"

Then run

pub run environment_config:generate

Dartfmt will fail because of invalid syntax.

❯ pub run environment_config:generate
Precompiling executable... (7.1s)
Precompiled environment_config:generate.
Could not format because the source could not be parsed:

line 1, column 46: Expected to find ';'.
  ╷
1 │ class Environment {static const String api = https://api.local;
  │                                              ^^^^^

As a work around the following works as expected.

environment_config:
  path: environment.dart
  class: Environment
  fields:
    api:
      short_name: a
      env_var: API_DOMAIN
      customClassValue:
        type: String
        pattern: 'https://__VALUE__'

Please use version contstraint in pubspec.yaml

this package is hard to use while developing angulardart because of conflicting dependency.

as stated in dart.dev, For a library package that you want users to reuse, though, it is important to specify version constraints.

Output path

Hi! This is more like a question, is possible to have an output path param? I need to normalize the param for windows, but passing from the file is not that easy. Is it possible?

Failed to precompile environment_config:generate

precompiling environment_config is failing, output of flutter --version and flutter pub run environment_config:generate below:

Flutter 1.20.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 216dee60c0 (8 days ago) • 2020-09-01 12:24:47 -0700
Engine • revision d1bc06f032
Tools • Dart 2.9.2



flutter pub run environment_config:generate
Precompiling executable...
Failed to precompile environment_config:generate:
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:32:8: Error: Error when reading '../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.8/lib/meta_meta.dart': No such file or directory
import 'package:meta/meta_meta.dart';
       ^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1456:43: Error: Type 'TargetKind' not found.
  bool _isValidTarget(AstNode target, Set<TargetKind> kinds) {
                                          ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1499:7: Error: Type 'TargetKind' not found.
  Set<TargetKind> _targetKindsFor(ElementAnnotation annotation) {
      ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1843:14: Error: Type 'TargetKind' not found.
extension on TargetKind {
             ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1456:43: Error: 'TargetKind' isn't a type.
  bool _isValidTarget(AstNode target, Set<TargetKind> kinds) {
                                          ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1458:29: Error: The getter 'TargetKind' isn't defined for the class 'BestPracticesVerifier'.
 - 'BestPracticesVerifier' is from 'package:analyzer/src/error/best_practices_verifier.dart' ('../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TargetKind'.
      return kinds.contains(TargetKind.classType) ||
                            ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1459:26: Error: The getter 'TargetKind' isn't defined for the class 'BestPracticesVerifier'.
 - 'BestPracticesVerifier' is from 'package:analyzer/src/error/best_practices_verifier.dart' ('../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TargetKind'.
          kinds.contains(TargetKind.type);
                         ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1462:26: Error: The getter 'TargetKind' isn't defined for the class 'BestPracticesVerifier'.
 - 'BestPracticesVerifier' is from 'package:analyzer/src/error/best_practices_verifier.dart' ('../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TargetKind'.
          kinds.contains(TargetKind.library);
                         ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1464:29: Error: The getter 'TargetKind' isn't defined for the class 'BestPracticesVerifier'.
 - 'BestPracticesVerifier' is from 'package:analyzer/src/error/best_practices_verifier.dart' ('../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TargetKind'.
      return kinds.contains(TargetKind.enumType) ||
                            ^^^^^^^^^^
../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart:1465:26: Error: The getter 'TargetKind' isn't defined for the class 'BestPracticesVerifier'.
 - 'BestPracticesVerifier' is from 'package:analyzer/src/error/best_practices_verifier.dart' ('../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.1/lib/src/error/best_practices_verifier.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'TargetKind'.
          kinds.contains(TargetKind.type);
                         ^^^^^^^^^^
pub finished with exit code 1```

Add lock fine

Add lock file generation to define diff between specified fields in local env and new fields to define set of required fields during verbose run.

Blocked by #8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.